<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>openttd.savegame</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://openttd-python.googlecode.com">OpenTTD-Python</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="openttd-module.html">Package&nbsp;openttd</a> ::
        Module&nbsp;savegame
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="openttd.savegame-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="openttd.savegame-module.html">Module openttd.savegame</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment">#!/bin/env python</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"># reading openttd .sav files with python</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment"># made by yorickvanpelt {AT} gmail {DOT} com</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">struct</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Module openttd.constants=openttd.constants-module.html"><a title="openttd.constants" class="py-name" href="#" onclick="return doclink('link-0', 'constants', 'link-0');">constants</a></tt> <tt class="py-keyword">import</tt> <tt id="link-1" class="py-name" targets="Variable openttd.constants.saveload_chunk_types=openttd.constants-module.html#saveload_chunk_types"><a title="openttd.constants.saveload_chunk_types" class="py-name" href="#" onclick="return doclink('link-1', 'saveload_chunk_types', 'link-1');">saveload_chunk_types</a></tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">array</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"> </tt>
<a name="LoadException"></a><div id="LoadException-def"><a name="L8"></a><tt class="py-lineno">  8</tt> <a class="py-toggle" href="#" id="LoadException-toggle" onclick="return toggle('LoadException');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="openttd.savegame.LoadException-class.html">LoadException</a><tt class="py-op">(</tt><tt class="py-base-class">Exception</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="LoadException-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="LoadException-expanded"><a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-docstring">    The exception raised by OTTDSaveGameParser when something goes wrong</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
</div><a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"> </tt>
<a name="CDataPacket"></a><div id="CDataPacket-def"><a name="L14"></a><tt class="py-lineno"> 14</tt> <a class="py-toggle" href="#" id="CDataPacket-toggle" onclick="return toggle('CDataPacket');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html">CDataPacket</a><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="CDataPacket-expanded"><a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line">    <tt id="link-2" class="py-name" targets="Variable openttd.client.DataPacket.size=openttd.client.DataPacket-class.html#size,Variable openttd.savegame.CDataPacket.size=openttd.savegame.CDataPacket-class.html#size"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-2', 'size', 'link-2');">size</a></tt><tt class="py-op">=</tt><tt class="py-number">0</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line">    <tt id="link-3" class="py-name" targets="Variable openttd.client.DataPacket.data=openttd.client.DataPacket-class.html#data,Variable openttd.savegame.CDataPacket.data=openttd.savegame.CDataPacket-class.html#data"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-3', 'data', 'link-3');">data</a></tt><tt class="py-op">=</tt><tt class="py-number">0</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line">    <tt id="link-4" class="py-name" targets="Variable openttd.client.DataPacket.offset=openttd.client.DataPacket-class.html#offset,Variable openttd.savegame.CDataPacket.offset=openttd.savegame.CDataPacket-class.html#offset"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-4', 'offset', 'link-4');">offset</a></tt><tt class="py-op">=</tt><tt class="py-number">0</tt> </tt>
<a name="CDataPacket.__init__"></a><div id="CDataPacket.__init__-def"><a name="L18"></a><tt class="py-lineno"> 18</tt> <a class="py-toggle" href="#" id="CDataPacket.__init__-toggle" onclick="return toggle('CDataPacket.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">data</tt><tt class="py-op">=</tt><tt class="py-string">""</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.__init__-expanded"><a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-5" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-5', 'size', 'link-2');">size</a></tt> <tt class="py-op">=</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt id="link-6" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-6', 'data', 'link-3');">data</a></tt><tt class="py-op">)</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-7" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-7', 'data', 'link-3');">data</a></tt> <tt class="py-op">=</tt> <tt id="link-8" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-8', 'data', 'link-3');">data</a></tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-9" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-9', 'offset', 'link-4');">offset</a></tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
</div><a name="CDataPacket.read_something"></a><div id="CDataPacket.read_something-def"><a name="L22"></a><tt class="py-lineno"> 22</tt> <a class="py-toggle" href="#" id="CDataPacket.read_something-toggle" onclick="return toggle('CDataPacket.read_something');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#read_something">read_something</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">type</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.read_something-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.read_something-expanded"><a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-docstring">        This method gets something from the data and returns it as array</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-docstring">        @param type: string containing types needed to unpack</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-docstring">        @type  type: string</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype:      list</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-docstring">        @returns:    list with unpacked stuff</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line">            <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">Struct</tt><tt class="py-op">(</tt><tt id="link-10" class="py-name" targets="Variable ottd_client_event.IRCChat.type=ottd_client_event.IRCChat-class.html#type"><a title="ottd_client_event.IRCChat.type" class="py-name" href="#" onclick="return doclink('link-10', 'type', 'link-10');">type</a></tt><tt class="py-op">)</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line">            <tt id="link-11" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-11', 'size', 'link-2');">size</a></tt> <tt class="py-op">=</tt> <tt class="py-name">s</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-12', 'size', 'link-2');">size</a></tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line">            <tt class="py-name">ret</tt> <tt class="py-op">=</tt> <tt class="py-name">s</tt><tt class="py-op">.</tt><tt id="link-13" class="py-name" targets="Function sstruct.unpack()=sstruct-module.html#unpack"><a title="sstruct.unpack" class="py-name" href="#" onclick="return doclink('link-13', 'unpack', 'link-13');">unpack</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-14', 'data', 'link-3');">data</a></tt><tt class="py-op">[</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-15" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-15', 'offset', 'link-4');">offset</a></tt><tt class="py-op">:</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-16', 'offset', 'link-4');">offset</a></tt><tt class="py-op">+</tt><tt id="link-17" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-17', 'size', 'link-2');">size</a></tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">AttributeError</tt><tt class="py-op">:</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line">            <tt id="link-18" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-18', 'size', 'link-2');">size</a></tt> <tt class="py-op">=</tt> <tt class="py-name">struct</tt><tt class="py-op">.</tt><tt id="link-19" class="py-name" targets="Function sstruct.calcsize()=sstruct-module.html#calcsize"><a title="sstruct.calcsize" class="py-name" href="#" onclick="return doclink('link-19', 'calcsize', 'link-19');">calcsize</a></tt><tt class="py-op">(</tt><tt id="link-20" class="py-name"><a title="ottd_client_event.IRCChat.type" class="py-name" href="#" onclick="return doclink('link-20', 'type', 'link-10');">type</a></tt><tt class="py-op">)</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line">            <tt class="py-name">ret</tt> <tt class="py-op">=</tt> <tt class="py-name">struct</tt><tt class="py-op">.</tt><tt id="link-21" class="py-name"><a title="sstruct.unpack" class="py-name" href="#" onclick="return doclink('link-21', 'unpack', 'link-13');">unpack</a></tt><tt class="py-op">(</tt><tt id="link-22" class="py-name"><a title="ottd_client_event.IRCChat.type" class="py-name" href="#" onclick="return doclink('link-22', 'type', 'link-10');">type</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-23" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-23', 'data', 'link-3');">data</a></tt><tt class="py-op">[</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-24" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-24', 'offset', 'link-4');">offset</a></tt><tt class="py-op">:</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-25" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-25', 'offset', 'link-4');">offset</a></tt><tt class="py-op">+</tt><tt id="link-26" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-26', 'size', 'link-2');">size</a></tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-27', 'offset', 'link-4');">offset</a></tt> <tt class="py-op">+=</tt> <tt id="link-28" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-28', 'size', 'link-2');">size</a></tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">ret</tt> </tt>
</div><a name="CDataPacket.write_something"></a><div id="CDataPacket.write_something-def"><a name="L39"></a><tt class="py-lineno"> 39</tt> <a class="py-toggle" href="#" id="CDataPacket.write_something-toggle" onclick="return toggle('CDataPacket.write_something');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#write_something">write_something</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">type</tt><tt class="py-op">,</tt> <tt class="py-param">something</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.write_something-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.write_something-expanded"><a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt class="py-docstring">        This method writes something to the data</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt class="py-docstring">        @param type:      string containing types needed to pack</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"><tt class="py-docstring">        @type  type:      string</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line"><tt class="py-docstring">        @param something: list with stuff to be packed</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line"><tt class="py-docstring">        @type  something: list</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line">            <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">Struct</tt><tt class="py-op">(</tt><tt id="link-29" class="py-name"><a title="ottd_client_event.IRCChat.type" class="py-name" href="#" onclick="return doclink('link-29', 'type', 'link-10');">type</a></tt><tt class="py-op">)</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line">            <tt class="py-name">buf</tt> <tt class="py-op">=</tt> <tt class="py-name">s</tt><tt class="py-op">.</tt><tt id="link-30" class="py-name" targets="Function sstruct.pack()=sstruct-module.html#pack"><a title="sstruct.pack" class="py-name" href="#" onclick="return doclink('link-30', 'pack', 'link-30');">pack</a></tt><tt class="py-op">(</tt><tt class="py-op">*</tt><tt class="py-name">something</tt><tt class="py-op">)</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line">            <tt id="link-31" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-31', 'size', 'link-2');">size</a></tt> <tt class="py-op">=</tt> <tt class="py-name">s</tt><tt class="py-op">.</tt><tt id="link-32" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-32', 'size', 'link-2');">size</a></tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">AttributeError</tt><tt class="py-op">:</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line">            <tt class="py-name">buf</tt> <tt class="py-op">=</tt> <tt class="py-name">struct</tt><tt class="py-op">.</tt><tt id="link-33" class="py-name"><a title="sstruct.pack" class="py-name" href="#" onclick="return doclink('link-33', 'pack', 'link-30');">pack</a></tt><tt class="py-op">(</tt><tt id="link-34" class="py-name"><a title="ottd_client_event.IRCChat.type" class="py-name" href="#" onclick="return doclink('link-34', 'type', 'link-10');">type</a></tt><tt class="py-op">,</tt> <tt class="py-op">*</tt><tt class="py-name">something</tt><tt class="py-op">)</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">            <tt id="link-35" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-35', 'size', 'link-2');">size</a></tt> <tt class="py-op">=</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">buf</tt><tt class="py-op">)</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-36" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-36', 'size', 'link-2');">size</a></tt> <tt class="py-op">+=</tt> <tt id="link-37" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-37', 'size', 'link-2');">size</a></tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-38" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-38', 'data', 'link-3');">data</a></tt> <tt class="py-op">+=</tt> <tt class="py-name">buf</tt> </tt>
</div><a name="CDataPacket.read_str"></a><div id="CDataPacket.read_str-def"><a name="L56"></a><tt class="py-lineno"> 56</tt> <a class="py-toggle" href="#" id="CDataPacket.read_str-toggle" onclick="return toggle('CDataPacket.read_str');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#read_str">read_str</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">len</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.read_str-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.read_str-expanded"><a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-39" class="py-name" targets="Method openttd.savegame.CDataPacket.read_something()=openttd.savegame.CDataPacket-class.html#read_something"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-39', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">)</tt><tt class="py-op">+</tt><tt class="py-string">'s'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
</div><a name="CDataPacket.read_uint8"></a><div id="CDataPacket.read_uint8-def"><a name="L58"></a><tt class="py-lineno"> 58</tt> <a class="py-toggle" href="#" id="CDataPacket.read_uint8-toggle" onclick="return toggle('CDataPacket.read_uint8');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#read_uint8">read_uint8</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.read_uint8-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.read_uint8-expanded"><a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-40" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-40', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'&gt;B'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
</div><a name="CDataPacket.read_int8"></a><div id="CDataPacket.read_int8-def"><a name="L60"></a><tt class="py-lineno"> 60</tt> <a class="py-toggle" href="#" id="CDataPacket.read_int8-toggle" onclick="return toggle('CDataPacket.read_int8');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#read_int8">read_int8</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.read_int8-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.read_int8-expanded"><a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-41" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-41', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'&gt;b'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
</div><a name="CDataPacket.read_byte"></a><div id="CDataPacket.read_byte-def"><a name="L62"></a><tt class="py-lineno"> 62</tt> <a class="py-toggle" href="#" id="CDataPacket.read_byte-toggle" onclick="return toggle('CDataPacket.read_byte');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#read_byte">read_byte</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.read_byte-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.read_byte-expanded"><a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line"><tt class="py-docstring">        Reads a byte from the data using string operators</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype:   int</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line"><tt class="py-docstring">        @returns: byte from the data</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line">        <tt class="py-name">offs</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-42" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-42', 'offset', 'link-4');">offset</a></tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-43" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-43', 'offset', 'link-4');">offset</a></tt> <tt class="py-op">+=</tt> <tt class="py-number">1</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">ord</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-44" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-44', 'data', 'link-3');">data</a></tt><tt class="py-op">[</tt><tt class="py-name">offs</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div><a name="CDataPacket.read_bytes"></a><div id="CDataPacket.read_bytes-def"><a name="L71"></a><tt class="py-lineno"> 71</tt> <a class="py-toggle" href="#" id="CDataPacket.read_bytes-toggle" onclick="return toggle('CDataPacket.read_bytes');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#read_bytes">read_bytes</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">number</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.read_bytes-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.read_bytes-expanded"><a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line">        <tt class="py-name">offs</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-45" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-45', 'offset', 'link-4');">offset</a></tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-46" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-46', 'offset', 'link-4');">offset</a></tt> <tt class="py-op">+=</tt> <tt class="py-name">number</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line">        <tt id="link-47" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-47', 'data', 'link-3');">data</a></tt> <tt class="py-op">=</tt> <tt class="py-name">map</tt><tt class="py-op">(</tt><tt class="py-name">ord</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-48" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-48', 'data', 'link-3');">data</a></tt><tt class="py-op">[</tt><tt class="py-name">offs</tt><tt class="py-op">:</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-49" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-49', 'offset', 'link-4');">offset</a></tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">tuple</tt><tt class="py-op">(</tt><tt id="link-50" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-50', 'data', 'link-3');">data</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="CDataPacket.read_uint16"></a><div id="CDataPacket.read_uint16-def"><a name="L76"></a><tt class="py-lineno"> 76</tt> <a class="py-toggle" href="#" id="CDataPacket.read_uint16-toggle" onclick="return toggle('CDataPacket.read_uint16');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#read_uint16">read_uint16</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.read_uint16-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.read_uint16-expanded"><a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-51" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-51', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'&gt;H'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
</div><a name="CDataPacket.read_int16"></a><div id="CDataPacket.read_int16-def"><a name="L78"></a><tt class="py-lineno"> 78</tt> <a class="py-toggle" href="#" id="CDataPacket.read_int16-toggle" onclick="return toggle('CDataPacket.read_int16');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#read_int16">read_int16</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.read_int16-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.read_int16-expanded"><a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-52" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-52', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'&gt;h'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
</div><a name="CDataPacket.read_uint32"></a><div id="CDataPacket.read_uint32-def"><a name="L80"></a><tt class="py-lineno"> 80</tt> <a class="py-toggle" href="#" id="CDataPacket.read_uint32-toggle" onclick="return toggle('CDataPacket.read_uint32');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#read_uint32">read_uint32</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.read_uint32-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.read_uint32-expanded"><a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-53" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-53', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'&gt;I'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
</div><a name="CDataPacket.read_int32"></a><div id="CDataPacket.read_int32-def"><a name="L82"></a><tt class="py-lineno"> 82</tt> <a class="py-toggle" href="#" id="CDataPacket.read_int32-toggle" onclick="return toggle('CDataPacket.read_int32');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#read_int32">read_int32</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.read_int32-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.read_int32-expanded"><a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-54" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-54', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'&gt;i'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
</div><a name="CDataPacket.read_uint64"></a><div id="CDataPacket.read_uint64-def"><a name="L84"></a><tt class="py-lineno"> 84</tt> <a class="py-toggle" href="#" id="CDataPacket.read_uint64-toggle" onclick="return toggle('CDataPacket.read_uint64');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#read_uint64">read_uint64</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.read_uint64-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.read_uint64-expanded"><a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-55" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-55', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'&gt;Q'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
</div><a name="CDataPacket.read_bool"></a><div id="CDataPacket.read_bool-def"><a name="L86"></a><tt class="py-lineno"> 86</tt> <a class="py-toggle" href="#" id="CDataPacket.read_bool-toggle" onclick="return toggle('CDataPacket.read_bool');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#read_bool">read_bool</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.read_bool-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.read_bool-expanded"><a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-56" class="py-name" targets="Method openttd.savegame.CDataPacket.read_byte()=openttd.savegame.CDataPacket-class.html#read_byte"><a title="openttd.savegame.CDataPacket.read_byte" class="py-name" href="#" onclick="return doclink('link-56', 'read_byte', 'link-56');">read_byte</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">!=</tt> <tt class="py-number">0</tt> </tt>
</div><a name="CDataPacket.write_str"></a><div id="CDataPacket.write_str-def"><a name="L88"></a><tt class="py-lineno"> 88</tt> <a class="py-toggle" href="#" id="CDataPacket.write_str-toggle" onclick="return toggle('CDataPacket.write_str');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#write_str">write_str</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">string</tt><tt class="py-op">,</tt> <tt class="py-param">leng</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.write_str-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.write_str-expanded"><a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">leng</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-57" class="py-name" targets="Method openttd.savegame.CDataPacket.write_something()=openttd.savegame.CDataPacket-class.html#write_something"><a title="openttd.savegame.CDataPacket.write_something" class="py-name" href="#" onclick="return doclink('link-57', 'write_something', 'link-57');">write_something</a></tt><tt class="py-op">(</tt><tt class="py-name">str</tt><tt class="py-op">(</tt><tt class="py-name">leng</tt><tt class="py-op">)</tt><tt class="py-op">+</tt><tt class="py-string">'s'</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt class="py-name">string</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-58" class="py-name"><a title="openttd.savegame.CDataPacket.write_something" class="py-name" href="#" onclick="return doclink('link-58', 'write_something', 'link-57');">write_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'z'</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt class="py-name">str</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div><a name="CDataPacket.write_uint8"></a><div id="CDataPacket.write_uint8-def"><a name="L92"></a><tt class="py-lineno"> 92</tt> <a class="py-toggle" href="#" id="CDataPacket.write_uint8-toggle" onclick="return toggle('CDataPacket.write_uint8');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#write_uint8">write_uint8</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">i</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.write_uint8-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.write_uint8-expanded"><a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-59" class="py-name"><a title="openttd.savegame.CDataPacket.write_something" class="py-name" href="#" onclick="return doclink('link-59', 'write_something', 'link-57');">write_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'&gt;B'</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div><a name="CDataPacket.write_uint16"></a><div id="CDataPacket.write_uint16-def"><a name="L94"></a><tt class="py-lineno"> 94</tt> <a class="py-toggle" href="#" id="CDataPacket.write_uint16-toggle" onclick="return toggle('CDataPacket.write_uint16');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#write_uint16">write_uint16</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">i</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.write_uint16-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.write_uint16-expanded"><a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-60" class="py-name"><a title="openttd.savegame.CDataPacket.write_something" class="py-name" href="#" onclick="return doclink('link-60', 'write_something', 'link-57');">write_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'&gt;H'</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div><a name="CDataPacket.write_uint32"></a><div id="CDataPacket.write_uint32-def"><a name="L96"></a><tt class="py-lineno"> 96</tt> <a class="py-toggle" href="#" id="CDataPacket.write_uint32-toggle" onclick="return toggle('CDataPacket.write_uint32');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#write_uint32">write_uint32</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">i</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.write_uint32-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.write_uint32-expanded"><a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-61" class="py-name"><a title="openttd.savegame.CDataPacket.write_something" class="py-name" href="#" onclick="return doclink('link-61', 'write_something', 'link-57');">write_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'&gt;I'</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div><a name="CDataPacket.write_uint64"></a><div id="CDataPacket.write_uint64-def"><a name="L98"></a><tt class="py-lineno"> 98</tt> <a class="py-toggle" href="#" id="CDataPacket.write_uint64-toggle" onclick="return toggle('CDataPacket.write_uint64');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#write_uint64">write_uint64</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">i</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.write_uint64-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.write_uint64-expanded"><a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-62" class="py-name"><a title="openttd.savegame.CDataPacket.write_something" class="py-name" href="#" onclick="return doclink('link-62', 'write_something', 'link-57');">write_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'&gt;Q'</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div><a name="CDataPacket.write_bool"></a><div id="CDataPacket.write_bool-def"><a name="L100"></a><tt class="py-lineno">100</tt> <a class="py-toggle" href="#" id="CDataPacket.write_bool-toggle" onclick="return toggle('CDataPacket.write_bool');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#write_bool">write_bool</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">b</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.write_bool-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.write_bool-expanded"><a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">b</tt><tt class="py-op">:</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-number">1</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-63" class="py-name"><a title="openttd.savegame.CDataPacket.write_something" class="py-name" href="#" onclick="return doclink('link-63', 'write_something', 'link-57');">write_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'B'</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div><a name="CDataPacket.read_OTTDSimpleGamma"></a><div id="CDataPacket.read_OTTDSimpleGamma-def"><a name="L106"></a><tt class="py-lineno">106</tt> <a class="py-toggle" href="#" id="CDataPacket.read_OTTDSimpleGamma-toggle" onclick="return toggle('CDataPacket.read_OTTDSimpleGamma');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#read_OTTDSimpleGamma">read_OTTDSimpleGamma</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.read_OTTDSimpleGamma-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.read_OTTDSimpleGamma-expanded"><a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">        <tt class="py-name">HasBit</tt> <tt class="py-op">=</tt> <tt class="py-keyword">lambda</tt> <tt class="py-name">x</tt><tt class="py-op">,</tt><tt class="py-name">y</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-name">x</tt> <tt class="py-op">&amp;</tt> <tt class="py-op">(</tt><tt class="py-number">1</tt> <tt class="py-op">&lt;&lt;</tt> <tt class="py-name">y</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> <tt class="py-op">!=</tt> <tt class="py-number">0</tt><tt class="py-op">;</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">        <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-64" class="py-name"><a title="openttd.savegame.CDataPacket.read_byte" class="py-name" href="#" onclick="return doclink('link-64', 'read_byte', 'link-56');">read_byte</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">HasBit</tt><tt class="py-op">(</tt><tt class="py-name">i</tt><tt class="py-op">,</tt> <tt class="py-number">7</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">&amp;=</tt> <tt class="py-op">~</tt><tt class="py-number">0x80</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">HasBit</tt><tt class="py-op">(</tt><tt class="py-name">i</tt><tt class="py-op">,</tt> <tt class="py-number">6</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">                <tt class="py-name">i</tt> <tt class="py-op">&amp;=</tt> <tt class="py-op">~</tt><tt class="py-number">0x40</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">HasBit</tt><tt class="py-op">(</tt><tt class="py-name">i</tt><tt class="py-op">,</tt> <tt class="py-number">5</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">                    <tt class="py-name">i</tt> <tt class="py-op">&amp;=</tt> <tt class="py-op">~</tt><tt class="py-number">0x20</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line">                    <tt class="py-keyword">if</tt> <tt class="py-name">HasBit</tt><tt class="py-op">(</tt><tt class="py-name">i</tt><tt class="py-op">,</tt> <tt class="py-number">4</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">                        <tt class="py-keyword">raise</tt> <tt id="link-65" class="py-name" targets="Class openttd.savegame.LoadException=openttd.savegame.LoadException-class.html"><a title="openttd.savegame.LoadException" class="py-name" href="#" onclick="return doclink('link-65', 'LoadException', 'link-65');">LoadException</a></tt><tt class="py-op">(</tt><tt class="py-string">"unsupported gamma"</tt><tt class="py-op">)</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line">                    <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-name">i</tt> <tt class="py-op">&lt;&lt;</tt> <tt class="py-number">8</tt><tt class="py-op">)</tt> <tt class="py-op">|</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-66" class="py-name"><a title="openttd.savegame.CDataPacket.read_byte" class="py-name" href="#" onclick="return doclink('link-66', 'read_byte', 'link-56');">read_byte</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">                <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-name">i</tt> <tt class="py-op">&lt;&lt;</tt>  <tt class="py-number">8</tt><tt class="py-op">)</tt> <tt class="py-op">|</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-67" class="py-name"><a title="openttd.savegame.CDataPacket.read_byte" class="py-name" href="#" onclick="return doclink('link-67', 'read_byte', 'link-56');">read_byte</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-name">i</tt> <tt class="py-op">&lt;&lt;</tt> <tt class="py-number">8</tt><tt class="py-op">)</tt> <tt class="py-op">|</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-68" class="py-name"><a title="openttd.savegame.CDataPacket.read_byte" class="py-name" href="#" onclick="return doclink('link-68', 'read_byte', 'link-56');">read_byte</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">i</tt> </tt>
</div><a name="CDataPacket.read_array"></a><div id="CDataPacket.read_array-def"><a name="L121"></a><tt class="py-lineno">121</tt> <a class="py-toggle" href="#" id="CDataPacket.read_array-toggle" onclick="return toggle('CDataPacket.read_array');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.CDataPacket-class.html#read_array">read_array</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">format</tt><tt class="py-op">,</tt> <tt class="py-param">number</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CDataPacket.read_array-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CDataPacket.read_array-expanded"><a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">        <tt class="py-name">a</tt> <tt class="py-op">=</tt> <tt class="py-name">array</tt><tt class="py-op">.</tt><tt class="py-name">array</tt><tt class="py-op">(</tt><tt class="py-name">format</tt><tt class="py-op">)</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">        <tt class="py-name">end_offs</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-69" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-69', 'offset', 'link-4');">offset</a></tt> <tt class="py-op">+</tt> <tt class="py-name">struct</tt><tt class="py-op">.</tt><tt id="link-70" class="py-name"><a title="sstruct.calcsize" class="py-name" href="#" onclick="return doclink('link-70', 'calcsize', 'link-19');">calcsize</a></tt><tt class="py-op">(</tt><tt class="py-name">format</tt><tt class="py-op">)</tt> <tt class="py-op">*</tt> <tt class="py-name">number</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">        <tt class="py-name">a</tt><tt class="py-op">.</tt><tt class="py-name">fromstring</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-71" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-71', 'data', 'link-3');">data</a></tt><tt class="py-op">[</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-72" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-72', 'offset', 'link-4');">offset</a></tt><tt class="py-op">:</tt><tt class="py-name">end_offs</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-73" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-73', 'offset', 'link-4');">offset</a></tt> <tt class="py-op">=</tt> <tt class="py-name">end_offs</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">a</tt><tt class="py-op">.</tt><tt class="py-name">tolist</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line"> </tt>
<a name="OTTDSaveGameParser"></a><div id="OTTDSaveGameParser-def"><a name="L128"></a><tt class="py-lineno">128</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser-toggle" onclick="return toggle('OTTDSaveGameParser');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html">OTTDSaveGameParser</a><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="OTTDSaveGameParser-expanded"><a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line"><tt class="py-docstring">    openttd-python class to parse openttd savegames</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar file: file used for reading/writing</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line"><tt class="py-docstring">    @type file: file</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar mapsize: mapsize, ['known'] will be set to True when MAPS is handled, else, default of 256x256 is used</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line"><tt class="py-docstring">    @type mapsize: dict</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar chunkhandlers: chunkhandlers looked for by findChunkHandler</tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line"><tt class="py-docstring">    @type chunkhandlers: dict</tt> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar verbosity: verbosity (&gt;1 will print chunk names when handling, &gt;2 will print chunk names when loading too)</tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line"><tt class="py-docstring">    @type verbosity: integer</tt> </tt>
<a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar rdp: containing compressed savegame, just raw from/to the file</tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line"><tt class="py-docstring">    @type rdp: CDataPacket instance</tt> </tt>
<a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar save_format: savegame format used currently (OTTD, OTTZ, OTTN)</tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line"><tt class="py-docstring">    @type save_format: string</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar saveload_version: major savegame version</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line"><tt class="py-docstring">    @type saveload_version: integer</tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar saveload_minor_version: minor savegame version</tt> </tt>
<a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line"><tt class="py-docstring">    @type saveload_minor_version: integer</tt> </tt>
<a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar data: compressed save data without header</tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line"><tt class="py-docstring">    @type data: raw data string</tt> </tt>
<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar dp: containing uncompressed savegame data</tt> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line"><tt class="py-docstring">    @type dp: CDataPacket instance</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar chunks: all chunks loaded from file</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line"><tt class="py-docstring">    @type chunks: array</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="OTTDSaveGameParser.__init__"></a><div id="OTTDSaveGameParser.__init__-def"><a name="L154"></a><tt class="py-lineno">154</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.__init__-toggle" onclick="return toggle('OTTDSaveGameParser.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">filename</tt><tt class="py-op">=</tt><tt class="py-string">""</tt><tt class="py-op">,</tt> <tt class="py-param">file</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.__init__-expanded"><a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line"><tt class="py-docstring">        Constructor for OTTDSaveGameParser class</tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line"><tt class="py-docstring">        @type filename:  string</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line"><tt class="py-docstring">        @param filename: filename to open if no file is specified</tt> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line"><tt class="py-docstring">        @type file:      file</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line"><tt class="py-docstring">        @param file:     file to use, if not given, try to open file from filename</tt> </tt>
<a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L162"></a><tt class="py-lineno">162</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">file</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">file</tt> <tt class="py-op">=</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">,</tt> <tt class="py-string">'rb'</tt><tt class="py-op">)</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">file</tt> <tt class="py-op">=</tt> <tt class="py-name">file</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-string">'x'</tt><tt class="py-op">:</tt> <tt class="py-number">256</tt><tt class="py-op">,</tt> <tt class="py-string">'y'</tt><tt class="py-op">:</tt> <tt class="py-number">256</tt><tt class="py-op">,</tt> <tt class="py-string">'known'</tt><tt class="py-op">:</tt> <tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-string">'total'</tt><tt class="py-op">:</tt> <tt class="py-number">256</tt><tt class="py-op">*</tt><tt class="py-number">256</tt><tt class="py-op">}</tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">chunkHandlers</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-74" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.registerChunkHandlers()=openttd.savegame.OTTDSaveGameParser-class.html#registerChunkHandlers"><a title="openttd.savegame.OTTDSaveGameParser.registerChunkHandlers" class="py-name" href="#" onclick="return doclink('link-74', 'registerChunkHandlers', 'link-74');">registerChunkHandlers</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">verbosity</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
</div><a name="OTTDSaveGameParser.readfile"></a><div id="OTTDSaveGameParser.readfile-def"><a name="L170"></a><tt class="py-lineno">170</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.readfile-toggle" onclick="return toggle('OTTDSaveGameParser.readfile');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#readfile">readfile</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.readfile-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.readfile-expanded"><a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line"><tt class="py-docstring">        Read the contents of the file open, close the file and destry its reference</tt> </tt>
<a name="L173"></a><tt class="py-lineno">173</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L174"></a><tt class="py-lineno">174</tt>  <tt class="py-line">        <tt class="py-name">rawdata</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">file</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">file</tt><tt class="py-op">.</tt><tt class="py-name">close</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">file</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">rdp</tt> <tt class="py-op">=</tt> <tt id="link-75" class="py-name" targets="Class openttd.savegame.CDataPacket=openttd.savegame.CDataPacket-class.html"><a title="openttd.savegame.CDataPacket" class="py-name" href="#" onclick="return doclink('link-75', 'CDataPacket', 'link-75');">CDataPacket</a></tt><tt class="py-op">(</tt><tt class="py-name">rawdata</tt><tt class="py-op">)</tt> </tt>
</div><a name="OTTDSaveGameParser.writefile"></a><div id="OTTDSaveGameParser.writefile-def"><a name="L178"></a><tt class="py-lineno">178</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.writefile-toggle" onclick="return toggle('OTTDSaveGameParser.writefile');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#writefile">writefile</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">filename</tt><tt class="py-op">,</tt> <tt class="py-param">file</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.writefile-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.writefile-expanded"><a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line"><tt class="py-docstring">        Write contents of the self.rdp to a file, and close the file afterwards</tt> </tt>
<a name="L181"></a><tt class="py-lineno">181</tt>  <tt class="py-line"><tt class="py-docstring">        @type  filename: string</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line"><tt class="py-docstring">        @param filename: filename to open if no file is specified</tt> </tt>
<a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line"><tt class="py-docstring">        @type  file:     file</tt> </tt>
<a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line"><tt class="py-docstring">        @param file:     file to use, if not given, try to open file from filename</tt> </tt>
<a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">file</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L187"></a><tt class="py-lineno">187</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">file</tt> <tt class="py-op">=</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">,</tt> <tt class="py-string">'wb'</tt><tt class="py-op">)</tt> </tt>
<a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">file</tt> <tt class="py-op">=</tt> <tt class="py-name">file</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">file</tt><tt class="py-op">.</tt><tt class="py-name">write</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">rdp</tt><tt class="py-op">.</tt><tt id="link-76" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-76', 'data', 'link-3');">data</a></tt><tt class="py-op">)</tt> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">file</tt><tt class="py-op">.</tt><tt class="py-name">close</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="OTTDSaveGameParser.readsaveheader"></a><div id="OTTDSaveGameParser.readsaveheader-def"><a name="L192"></a><tt class="py-lineno">192</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.readsaveheader-toggle" onclick="return toggle('OTTDSaveGameParser.readsaveheader');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#readsaveheader">readsaveheader</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.readsaveheader-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.readsaveheader-expanded"><a name="L193"></a><tt class="py-lineno">193</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line"><tt class="py-docstring">        Read the savegame format, version and data and destroy self.rdp</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">save_format</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">rdp</tt><tt class="py-op">.</tt><tt id="link-77" class="py-name" targets="Method openttd.savegame.CDataPacket.read_str()=openttd.savegame.CDataPacket-class.html#read_str"><a title="openttd.savegame.CDataPacket.read_str" class="py-name" href="#" onclick="return doclink('link-77', 'read_str', 'link-77');">read_str</a></tt><tt class="py-op">(</tt><tt class="py-number">4</tt><tt class="py-op">)</tt> <tt class="py-comment"># read the save format(compression format[LZO, ZLIB, NONE]</tt> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line">        <tt class="py-name">slver</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">rdp</tt><tt class="py-op">.</tt><tt id="link-78" class="py-name" targets="Method openttd.savegame.CDataPacket.read_uint32()=openttd.savegame.CDataPacket-class.html#read_uint32"><a title="openttd.savegame.CDataPacket.read_uint32" class="py-name" href="#" onclick="return doclink('link-78', 'read_uint32', 'link-78');">read_uint32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_version</tt> <tt class="py-op">=</tt> <tt class="py-name">slver</tt> <tt class="py-op">&gt;&gt;</tt> <tt class="py-number">16</tt> </tt>
<a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_minor_version</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-name">slver</tt> <tt class="py-op">&gt;&gt;</tt> <tt class="py-number">8</tt><tt class="py-op">)</tt> <tt class="py-op">&amp;</tt> <tt class="py-number">0xFF</tt> <tt class="py-comment"># the minor savegame version is not used anymore from 18.0 on, but still there as it can't be removed easily</tt> </tt>
<a name="L200"></a><tt class="py-lineno">200</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-79" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-79', 'data', 'link-3');">data</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">rdp</tt><tt class="py-op">.</tt><tt id="link-80" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-80', 'data', 'link-3');">data</a></tt><tt class="py-op">[</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">rdp</tt><tt class="py-op">.</tt><tt id="link-81" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-81', 'offset', 'link-4');">offset</a></tt><tt class="py-op">:</tt><tt class="py-op">]</tt> <tt class="py-comment"># store the actual save data</tt> </tt>
<a name="L201"></a><tt class="py-lineno">201</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">rdp</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> <tt class="py-comment"># clean the rdp to save memory</tt> </tt>
</div><a name="OTTDSaveGameParser.writesaveheader"></a><div id="OTTDSaveGameParser.writesaveheader-def"><a name="L202"></a><tt class="py-lineno">202</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.writesaveheader-toggle" onclick="return toggle('OTTDSaveGameParser.writesaveheader');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#writesaveheader">writesaveheader</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">save_format</tt><tt class="py-op">,</tt> <tt class="py-param">major_version</tt><tt class="py-op">,</tt> <tt class="py-param">minor_version</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.writesaveheader-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.writesaveheader-expanded"><a name="L203"></a><tt class="py-lineno">203</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L204"></a><tt class="py-lineno">204</tt>  <tt class="py-line"><tt class="py-docstring">        Create a savegame header with format, version and data into self.rdp</tt> </tt>
<a name="L205"></a><tt class="py-lineno">205</tt>  <tt class="py-line"><tt class="py-docstring">        @type  save_format:   string</tt> </tt>
<a name="L206"></a><tt class="py-lineno">206</tt>  <tt class="py-line"><tt class="py-docstring">        @param save_format:   save format to use (OTTZ, OTTN, OTTD)</tt> </tt>
<a name="L207"></a><tt class="py-lineno">207</tt>  <tt class="py-line"><tt class="py-docstring">        @type  major_version: int</tt> </tt>
<a name="L208"></a><tt class="py-lineno">208</tt>  <tt class="py-line"><tt class="py-docstring">        @type  minor_version: int</tt> </tt>
<a name="L209"></a><tt class="py-lineno">209</tt>  <tt class="py-line"><tt class="py-docstring">        @param major_version: major version to use</tt> </tt>
<a name="L210"></a><tt class="py-lineno">210</tt>  <tt class="py-line"><tt class="py-docstring">        @param minor_version: minor version to use ( 0 if not given)</tt> </tt>
<a name="L211"></a><tt class="py-lineno">211</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L212"></a><tt class="py-lineno">212</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">rdp</tt> <tt class="py-op">=</tt> <tt id="link-82" class="py-name"><a title="openttd.savegame.CDataPacket" class="py-name" href="#" onclick="return doclink('link-82', 'CDataPacket', 'link-75');">CDataPacket</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L213"></a><tt class="py-lineno">213</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">rdp</tt><tt class="py-op">.</tt><tt id="link-83" class="py-name" targets="Method openttd.savegame.CDataPacket.write_str()=openttd.savegame.CDataPacket-class.html#write_str"><a title="openttd.savegame.CDataPacket.write_str" class="py-name" href="#" onclick="return doclink('link-83', 'write_str', 'link-83');">write_str</a></tt><tt class="py-op">(</tt><tt class="py-name">save_format</tt><tt class="py-op">,</tt> <tt class="py-number">4</tt><tt class="py-op">)</tt> </tt>
<a name="L214"></a><tt class="py-lineno">214</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">rdp</tt><tt class="py-op">.</tt><tt id="link-84" class="py-name" targets="Method openttd.savegame.CDataPacket.write_uint32()=openttd.savegame.CDataPacket-class.html#write_uint32"><a title="openttd.savegame.CDataPacket.write_uint32" class="py-name" href="#" onclick="return doclink('link-84', 'write_uint32', 'link-84');">write_uint32</a></tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">major_version</tt> <tt class="py-op">&lt;&lt;</tt> <tt class="py-number">16</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-op">(</tt><tt class="py-name">minor_version</tt> <tt class="py-op">&lt;&lt;</tt> <tt class="py-number">8</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> <tt class="py-comment"># write the savegame version</tt> </tt>
<a name="L215"></a><tt class="py-lineno">215</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">rdp</tt><tt class="py-op">.</tt><tt id="link-85" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-85', 'data', 'link-3');">data</a></tt> <tt class="py-op">+=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-86" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-86', 'data', 'link-3');">data</a></tt> </tt>
<a name="L216"></a><tt class="py-lineno">216</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">rdp</tt><tt class="py-op">.</tt><tt id="link-87" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-87', 'size', 'link-2');">size</a></tt> <tt class="py-op">+=</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-88" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-88', 'data', 'link-3');">data</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="OTTDSaveGameParser.getSaveGameFormat"></a><div id="OTTDSaveGameParser.getSaveGameFormat-def"><a name="L217"></a><tt class="py-lineno">217</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.getSaveGameFormat-toggle" onclick="return toggle('OTTDSaveGameParser.getSaveGameFormat');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#getSaveGameFormat">getSaveGameFormat</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">formatname</tt><tt class="py-op">=</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.getSaveGameFormat-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.getSaveGameFormat-expanded"><a name="L218"></a><tt class="py-lineno">218</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L219"></a><tt class="py-lineno">219</tt>  <tt class="py-line"><tt class="py-docstring">        Get a savegame format defenition</tt> </tt>
<a name="L220"></a><tt class="py-lineno">220</tt>  <tt class="py-line"><tt class="py-docstring">        @type  formatname: string</tt> </tt>
<a name="L221"></a><tt class="py-lineno">221</tt>  <tt class="py-line"><tt class="py-docstring">        @param formatname: format to look for(uncompressed, LZO, ZLIB), if not given, this method returns the savegame format of the savegame currently loaded</tt> </tt>
<a name="L222"></a><tt class="py-lineno">222</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype:   tuple</tt> </tt>
<a name="L223"></a><tt class="py-lineno">223</tt>  <tt class="py-line"><tt class="py-docstring">        @returns: tuple containing human readable description, the way it is stored in the savegame, function to uncompress, function to compress</tt> </tt>
<a name="L224"></a><tt class="py-lineno">224</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L225"></a><tt class="py-lineno">225</tt>  <tt class="py-line">        <tt class="py-keyword">def</tt> <tt class="py-def-name">uncompressNone</tt><tt class="py-op">(</tt><tt class="py-param">data</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L226"></a><tt class="py-lineno">226</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt id="link-89" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-89', 'data', 'link-3');">data</a></tt> </tt>
</div><a name="L227"></a><tt class="py-lineno">227</tt>  <tt class="py-line">        <tt class="py-keyword">def</tt> <tt class="py-def-name">uncompressLZO</tt><tt class="py-op">(</tt><tt class="py-param">data</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L228"></a><tt class="py-lineno">228</tt>  <tt class="py-line">            <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L229"></a><tt class="py-lineno">229</tt>  <tt class="py-line">                <tt class="py-keyword">import</tt> <tt class="py-name">lzo</tt> </tt>
<a name="L230"></a><tt class="py-lineno">230</tt>  <tt class="py-line">            <tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt>
<a name="L231"></a><tt class="py-lineno">231</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt id="link-90" class="py-name"><a title="openttd.savegame.LoadException" class="py-name" href="#" onclick="return doclink('link-90', 'LoadException', 'link-65');">LoadException</a></tt><tt class="py-op">(</tt><tt class="py-string">"can't load LZO saves, no LZO"</tt><tt class="py-op">)</tt> </tt>
<a name="L232"></a><tt class="py-lineno">232</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L233"></a><tt class="py-lineno">233</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-name">lzo</tt><tt class="py-op">.</tt><tt class="py-name">decompress</tt><tt class="py-op">(</tt><tt id="link-91" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-91', 'data', 'link-3');">data</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L234"></a><tt class="py-lineno">234</tt>  <tt class="py-line">        <tt class="py-keyword">def</tt> <tt class="py-def-name">uncompressZLIB</tt><tt class="py-op">(</tt><tt class="py-param">data</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L235"></a><tt class="py-lineno">235</tt>  <tt class="py-line">            <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L236"></a><tt class="py-lineno">236</tt>  <tt class="py-line">                <tt class="py-keyword">import</tt> <tt class="py-name">zlib</tt> </tt>
<a name="L237"></a><tt class="py-lineno">237</tt>  <tt class="py-line">            <tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt>
<a name="L238"></a><tt class="py-lineno">238</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt id="link-92" class="py-name"><a title="openttd.savegame.LoadException" class="py-name" href="#" onclick="return doclink('link-92', 'LoadException', 'link-65');">LoadException</a></tt><tt class="py-op">(</tt><tt class="py-string">"can't load ZLIB saves, no ZLIB"</tt><tt class="py-op">)</tt> </tt>
<a name="L239"></a><tt class="py-lineno">239</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L240"></a><tt class="py-lineno">240</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-name">zlib</tt><tt class="py-op">.</tt><tt class="py-name">decompress</tt><tt class="py-op">(</tt><tt id="link-93" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-93', 'data', 'link-3');">data</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L241"></a><tt class="py-lineno">241</tt>  <tt class="py-line">        <tt class="py-keyword">def</tt> <tt class="py-def-name">compressNone</tt><tt class="py-op">(</tt><tt class="py-param">data</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L242"></a><tt class="py-lineno">242</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt id="link-94" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-94', 'data', 'link-3');">data</a></tt> </tt>
</div><a name="L243"></a><tt class="py-lineno">243</tt>  <tt class="py-line">        <tt class="py-keyword">def</tt> <tt class="py-def-name">compressLZO</tt><tt class="py-op">(</tt><tt class="py-param">data</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L244"></a><tt class="py-lineno">244</tt>  <tt class="py-line">            <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L245"></a><tt class="py-lineno">245</tt>  <tt class="py-line">                <tt class="py-keyword">import</tt> <tt class="py-name">lzo</tt> </tt>
<a name="L246"></a><tt class="py-lineno">246</tt>  <tt class="py-line">            <tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt>
<a name="L247"></a><tt class="py-lineno">247</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt id="link-95" class="py-name"><a title="openttd.savegame.LoadException" class="py-name" href="#" onclick="return doclink('link-95', 'LoadException', 'link-65');">LoadException</a></tt><tt class="py-op">(</tt><tt class="py-string">"can't save LZO saves, no LZO"</tt><tt class="py-op">)</tt> </tt>
<a name="L248"></a><tt class="py-lineno">248</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L249"></a><tt class="py-lineno">249</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-name">lzo</tt><tt class="py-op">.</tt><tt id="link-96" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.compress()=openttd.savegame.OTTDSaveGameParser-class.html#compress,Method plugins.stats.MyHandler.compress()=plugins.stats.MyHandler-class.html#compress,Method plugins.webserver.MyHandler.compress()=plugins.webserver.MyHandler-class.html#compress,Method webserver.MyHandler.compress()=webserver.MyHandler-class.html#compress"><a title="openttd.savegame.OTTDSaveGameParser.compress
plugins.stats.MyHandler.compress
plugins.webserver.MyHandler.compress
webserver.MyHandler.compress" class="py-name" href="#" onclick="return doclink('link-96', 'compress', 'link-96');">compress</a></tt><tt class="py-op">(</tt><tt id="link-97" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-97', 'data', 'link-3');">data</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L250"></a><tt class="py-lineno">250</tt>  <tt class="py-line">        <tt class="py-keyword">def</tt> <tt class="py-def-name">compressZLIB</tt><tt class="py-op">(</tt><tt class="py-param">data</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L251"></a><tt class="py-lineno">251</tt>  <tt class="py-line">            <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L252"></a><tt class="py-lineno">252</tt>  <tt class="py-line">                <tt class="py-keyword">import</tt> <tt class="py-name">zlib</tt> </tt>
<a name="L253"></a><tt class="py-lineno">253</tt>  <tt class="py-line">            <tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt>
<a name="L254"></a><tt class="py-lineno">254</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt id="link-98" class="py-name"><a title="openttd.savegame.LoadException" class="py-name" href="#" onclick="return doclink('link-98', 'LoadException', 'link-65');">LoadException</a></tt><tt class="py-op">(</tt><tt class="py-string">"can't save ZLIB saves, no ZLIB"</tt><tt class="py-op">)</tt> </tt>
<a name="L255"></a><tt class="py-lineno">255</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L256"></a><tt class="py-lineno">256</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-name">zlib</tt><tt class="py-op">.</tt><tt id="link-99" class="py-name"><a title="openttd.savegame.OTTDSaveGameParser.compress
plugins.stats.MyHandler.compress
plugins.webserver.MyHandler.compress
webserver.MyHandler.compress" class="py-name" href="#" onclick="return doclink('link-99', 'compress', 'link-96');">compress</a></tt><tt class="py-op">(</tt><tt id="link-100" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-100', 'data', 'link-3');">data</a></tt><tt class="py-op">)</tt>                 </tt>
</div><a name="L257"></a><tt class="py-lineno">257</tt>  <tt class="py-line">        <tt class="py-name">formats</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt> </tt>
<a name="L258"></a><tt class="py-lineno">258</tt>  <tt class="py-line">            <tt class="py-op">(</tt><tt class="py-string">"LZO"</tt>         <tt class="py-op">,</tt> <tt class="py-string">"OTTD"</tt><tt class="py-op">,</tt> <tt class="py-name">uncompressLZO</tt> <tt class="py-op">,</tt> <tt class="py-name">compressLZO</tt> <tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L259"></a><tt class="py-lineno">259</tt>  <tt class="py-line">            <tt class="py-op">(</tt><tt class="py-string">"uncompressed"</tt><tt class="py-op">,</tt> <tt class="py-string">"OTTN"</tt><tt class="py-op">,</tt> <tt class="py-name">uncompressNone</tt><tt class="py-op">,</tt> <tt class="py-name">compressNone</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L260"></a><tt class="py-lineno">260</tt>  <tt class="py-line">            <tt class="py-op">(</tt><tt class="py-string">"ZLIB"</tt>        <tt class="py-op">,</tt> <tt class="py-string">"OTTZ"</tt><tt class="py-op">,</tt> <tt class="py-name">uncompressZLIB</tt><tt class="py-op">,</tt> <tt class="py-name">compressZLIB</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L261"></a><tt class="py-lineno">261</tt>  <tt class="py-line">        <tt class="py-op">)</tt> </tt>
<a name="L262"></a><tt class="py-lineno">262</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">formatname</tt> <tt class="py-op">==</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">:</tt> </tt>
<a name="L263"></a><tt class="py-lineno">263</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">mat</tt> <tt class="py-keyword">in</tt> <tt class="py-name">formats</tt><tt class="py-op">:</tt> </tt>
<a name="L264"></a><tt class="py-lineno">264</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">mat</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">save_format</tt><tt class="py-op">:</tt> </tt>
<a name="L265"></a><tt class="py-lineno">265</tt>  <tt class="py-line">                    <tt class="py-keyword">return</tt> <tt class="py-name">mat</tt> </tt>
<a name="L266"></a><tt class="py-lineno">266</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L267"></a><tt class="py-lineno">267</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt id="link-101" class="py-name"><a title="openttd.savegame.LoadException" class="py-name" href="#" onclick="return doclink('link-101', 'LoadException', 'link-65');">LoadException</a></tt><tt class="py-op">(</tt><tt class="py-string">"unknown save format"</tt><tt class="py-op">)</tt> </tt>
<a name="L268"></a><tt class="py-lineno">268</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L269"></a><tt class="py-lineno">269</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">mat</tt> <tt class="py-keyword">in</tt> <tt class="py-name">formats</tt><tt class="py-op">:</tt> </tt>
<a name="L270"></a><tt class="py-lineno">270</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">mat</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt class="py-name">formatname</tt><tt class="py-op">:</tt> </tt>
<a name="L271"></a><tt class="py-lineno">271</tt>  <tt class="py-line">                    <tt class="py-keyword">return</tt> <tt class="py-name">mat</tt> </tt>
<a name="L272"></a><tt class="py-lineno">272</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L273"></a><tt class="py-lineno">273</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt> </tt>
</div><a name="OTTDSaveGameParser.uncompress"></a><div id="OTTDSaveGameParser.uncompress-def"><a name="L274"></a><tt class="py-lineno">274</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.uncompress-toggle" onclick="return toggle('OTTDSaveGameParser.uncompress');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#uncompress">uncompress</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.uncompress-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.uncompress-expanded"><a name="L275"></a><tt class="py-lineno">275</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L276"></a><tt class="py-lineno">276</tt>  <tt class="py-line"><tt class="py-docstring">        Looks up the savegameformat and uses its decompressor to decompress the data to to self.dp</tt> </tt>
<a name="L277"></a><tt class="py-lineno">277</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L278"></a><tt class="py-lineno">278</tt>  <tt class="py-line">        <tt class="py-name">decompressor</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-102" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.getSaveGameFormat()=openttd.savegame.OTTDSaveGameParser-class.html#getSaveGameFormat"><a title="openttd.savegame.OTTDSaveGameParser.getSaveGameFormat" class="py-name" href="#" onclick="return doclink('link-102', 'getSaveGameFormat', 'link-102');">getSaveGameFormat</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> </tt>
<a name="L279"></a><tt class="py-lineno">279</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt> <tt class="py-op">=</tt> <tt id="link-103" class="py-name"><a title="openttd.savegame.CDataPacket" class="py-name" href="#" onclick="return doclink('link-103', 'CDataPacket', 'link-75');">CDataPacket</a></tt><tt class="py-op">(</tt><tt class="py-name">decompressor</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-104" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-104', 'data', 'link-3');">data</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="OTTDSaveGameParser.compress"></a><div id="OTTDSaveGameParser.compress-def"><a name="L280"></a><tt class="py-lineno">280</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.compress-toggle" onclick="return toggle('OTTDSaveGameParser.compress');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#compress">compress</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">format</tt><tt class="py-op">=</tt><tt class="py-string">"uncompressed"</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.compress-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.compress-expanded"><a name="L281"></a><tt class="py-lineno">281</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L282"></a><tt class="py-lineno">282</tt>  <tt class="py-line"><tt class="py-docstring">        Looks up the savegameformat specified with the arguments and uses its compressor to compress the data to to self.data</tt> </tt>
<a name="L283"></a><tt class="py-lineno">283</tt>  <tt class="py-line"><tt class="py-docstring">        @type  format: string</tt> </tt>
<a name="L284"></a><tt class="py-lineno">284</tt>  <tt class="py-line"><tt class="py-docstring">        @param format: human readable format description to look for</tt> </tt>
<a name="L285"></a><tt class="py-lineno">285</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L286"></a><tt class="py-lineno">286</tt>  <tt class="py-line">        <tt class="py-name">compressor</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-105" class="py-name"><a title="openttd.savegame.OTTDSaveGameParser.getSaveGameFormat" class="py-name" href="#" onclick="return doclink('link-105', 'getSaveGameFormat', 'link-102');">getSaveGameFormat</a></tt><tt class="py-op">(</tt><tt class="py-name">format</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">3</tt><tt class="py-op">]</tt> </tt>
<a name="L287"></a><tt class="py-lineno">287</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-106" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-106', 'data', 'link-3');">data</a></tt> <tt class="py-op">=</tt> <tt class="py-name">compressor</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-107" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-107', 'data', 'link-3');">data</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="OTTDSaveGameParser.isSaveVersionBelow"></a><div id="OTTDSaveGameParser.isSaveVersionBelow-def"><a name="L288"></a><tt class="py-lineno">288</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.isSaveVersionBelow-toggle" onclick="return toggle('OTTDSaveGameParser.isSaveVersionBelow');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#isSaveVersionBelow">isSaveVersionBelow</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">major</tt><tt class="py-op">,</tt> <tt class="py-param">minor</tt><tt class="py-op">=</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.isSaveVersionBelow-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.isSaveVersionBelow-expanded"><a name="L289"></a><tt class="py-lineno">289</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L290"></a><tt class="py-lineno">290</tt>  <tt class="py-line"><tt class="py-docstring">        Checks if the savegame version is below a certain one</tt> </tt>
<a name="L291"></a><tt class="py-lineno">291</tt>  <tt class="py-line"><tt class="py-docstring">        @type  major: integer</tt> </tt>
<a name="L292"></a><tt class="py-lineno">292</tt>  <tt class="py-line"><tt class="py-docstring">        @type  minor: integer</tt> </tt>
<a name="L293"></a><tt class="py-lineno">293</tt>  <tt class="py-line"><tt class="py-docstring">        @param major: major savegame version to check for</tt> </tt>
<a name="L294"></a><tt class="py-lineno">294</tt>  <tt class="py-line"><tt class="py-docstring">        @param minor: minor savegame version, if not given, not checked at all</tt> </tt>
<a name="L295"></a><tt class="py-lineno">295</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype:       boolean</tt> </tt>
<a name="L296"></a><tt class="py-lineno">296</tt>  <tt class="py-line"><tt class="py-docstring">        @returns:     True if the savegame version is below</tt> </tt>
<a name="L297"></a><tt class="py-lineno">297</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L298"></a><tt class="py-lineno">298</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_version</tt> <tt class="py-op">&lt;</tt> <tt class="py-name">major</tt><tt class="py-op">:</tt> </tt>
<a name="L299"></a><tt class="py-lineno">299</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">True</tt> </tt>
<a name="L300"></a><tt class="py-lineno">300</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">minor</tt> <tt class="py-op">!=</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt> <tt class="py-keyword">and</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_minor_version</tt> <tt class="py-op">==</tt> <tt class="py-name">major</tt> <tt class="py-keyword">and</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_minor_version</tt> <tt class="py-op">&lt;</tt> <tt class="py-name">minor</tt><tt class="py-op">:</tt> </tt>
<a name="L301"></a><tt class="py-lineno">301</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">True</tt> </tt>
<a name="L302"></a><tt class="py-lineno">302</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">False</tt> </tt>
</div><a name="OTTDSaveGameParser.isSaveVersionEqualOrAbove"></a><div id="OTTDSaveGameParser.isSaveVersionEqualOrAbove-def"><a name="L303"></a><tt class="py-lineno">303</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.isSaveVersionEqualOrAbove-toggle" onclick="return toggle('OTTDSaveGameParser.isSaveVersionEqualOrAbove');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#isSaveVersionEqualOrAbove">isSaveVersionEqualOrAbove</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">major</tt><tt class="py-op">,</tt> <tt class="py-param">minor</tt><tt class="py-op">=</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.isSaveVersionEqualOrAbove-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.isSaveVersionEqualOrAbove-expanded"><a name="L304"></a><tt class="py-lineno">304</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L305"></a><tt class="py-lineno">305</tt>  <tt class="py-line"><tt class="py-docstring">        Checks if the savegame version is equal or above a certain one</tt> </tt>
<a name="L306"></a><tt class="py-lineno">306</tt>  <tt class="py-line"><tt class="py-docstring">        @type  major: integer</tt> </tt>
<a name="L307"></a><tt class="py-lineno">307</tt>  <tt class="py-line"><tt class="py-docstring">        @type  minor: integer</tt> </tt>
<a name="L308"></a><tt class="py-lineno">308</tt>  <tt class="py-line"><tt class="py-docstring">        @param major: major savegame version to check for</tt> </tt>
<a name="L309"></a><tt class="py-lineno">309</tt>  <tt class="py-line"><tt class="py-docstring">        @param minor: minor savegame version, if not given, not checked at all</tt> </tt>
<a name="L310"></a><tt class="py-lineno">310</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype:       boolean</tt> </tt>
<a name="L311"></a><tt class="py-lineno">311</tt>  <tt class="py-line"><tt class="py-docstring">        @returns:     True if the savegame version is above or equal</tt> </tt>
<a name="L312"></a><tt class="py-lineno">312</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L313"></a><tt class="py-lineno">313</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_version</tt> <tt class="py-op">&gt;</tt> <tt class="py-name">major</tt><tt class="py-op">:</tt> </tt>
<a name="L314"></a><tt class="py-lineno">314</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">True</tt> </tt>
<a name="L315"></a><tt class="py-lineno">315</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">minor</tt> <tt class="py-op">!=</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt> <tt class="py-keyword">and</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_major_version</tt> <tt class="py-op">==</tt> <tt class="py-name">major</tt> <tt class="py-keyword">and</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_minor_version</tt> <tt class="py-op">&gt;=</tt> <tt class="py-name">minor</tt><tt class="py-op">:</tt> </tt>
<a name="L316"></a><tt class="py-lineno">316</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">True</tt> </tt>
<a name="L317"></a><tt class="py-lineno">317</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_major_version</tt> <tt class="py-op">==</tt> <tt class="py-name">major</tt><tt class="py-op">:</tt> </tt>
<a name="L318"></a><tt class="py-lineno">318</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">True</tt> </tt>
<a name="L319"></a><tt class="py-lineno">319</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">False</tt> </tt>
</div><a name="OTTDSaveGameParser.findChunkHandler"></a><div id="OTTDSaveGameParser.findChunkHandler-def"><a name="L320"></a><tt class="py-lineno">320</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.findChunkHandler-toggle" onclick="return toggle('OTTDSaveGameParser.findChunkHandler');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#findChunkHandler">findChunkHandler</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">chunkname</tt><tt class="py-op">,</tt> <tt class="py-param">overwritehandlers</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.findChunkHandler-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.findChunkHandler-expanded"><a name="L321"></a><tt class="py-lineno">321</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L322"></a><tt class="py-lineno">322</tt>  <tt class="py-line"><tt class="py-docstring">        Finds chunk handler in overwritehandlers and self.chunkHandlers, if False is specified instead of a function, a function that returns None is returned</tt> </tt>
<a name="L323"></a><tt class="py-lineno">323</tt>  <tt class="py-line"><tt class="py-docstring">        @type          chunkname: string</tt> </tt>
<a name="L324"></a><tt class="py-lineno">324</tt>  <tt class="py-line"><tt class="py-docstring">        @param         chunkname: chunkid to look for</tt> </tt>
<a name="L325"></a><tt class="py-lineno">325</tt>  <tt class="py-line"><tt class="py-docstring">        @type  overwritehandlers: dict</tt> </tt>
<a name="L326"></a><tt class="py-lineno">326</tt>  <tt class="py-line"><tt class="py-docstring">        @param overwritehandlers: checked before self.chunkHandlers</tt> </tt>
<a name="L327"></a><tt class="py-lineno">327</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype:                   function</tt> </tt>
<a name="L328"></a><tt class="py-lineno">328</tt>  <tt class="py-line"><tt class="py-docstring">        @returns:                 chunk handler or a function that will return None</tt> </tt>
<a name="L329"></a><tt class="py-lineno">329</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L330"></a><tt class="py-lineno">330</tt>  <tt class="py-line">        <tt class="py-keyword">def</tt> <tt class="py-def-name">nothing</tt><tt class="py-op">(</tt><tt class="py-op">*</tt><tt class="py-param">argv</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L331"></a><tt class="py-lineno">331</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">None</tt> </tt>
</div><a name="L332"></a><tt class="py-lineno">332</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">chunkname</tt> <tt class="py-keyword">in</tt> <tt class="py-name">overwritehandlers</tt><tt class="py-op">:</tt> </tt>
<a name="L333"></a><tt class="py-lineno">333</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">overwritehandlers</tt><tt class="py-op">[</tt><tt class="py-name">chunkname</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt class="py-name">False</tt><tt class="py-op">:</tt> </tt>
<a name="L334"></a><tt class="py-lineno">334</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-name">overwritehandlers</tt><tt class="py-op">[</tt><tt class="py-name">chunkname</tt><tt class="py-op">]</tt> </tt>
<a name="L335"></a><tt class="py-lineno">335</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L336"></a><tt class="py-lineno">336</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-name">nothing</tt> </tt>
<a name="L337"></a><tt class="py-lineno">337</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">chunkname</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">chunkHandlers</tt><tt class="py-op">:</tt> </tt>
<a name="L338"></a><tt class="py-lineno">338</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">chunkHandlers</tt><tt class="py-op">[</tt><tt class="py-name">chunkname</tt><tt class="py-op">]</tt> </tt>
<a name="L339"></a><tt class="py-lineno">339</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L340"></a><tt class="py-lineno">340</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">nothing</tt> </tt>
</div><a name="OTTDSaveGameParser.registerChunkHandlers"></a><div id="OTTDSaveGameParser.registerChunkHandlers-def"><a name="L341"></a><tt class="py-lineno">341</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.registerChunkHandlers-toggle" onclick="return toggle('OTTDSaveGameParser.registerChunkHandlers');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#registerChunkHandlers">registerChunkHandlers</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.registerChunkHandlers-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.registerChunkHandlers-expanded"><a name="L342"></a><tt class="py-lineno">342</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L343"></a><tt class="py-lineno">343</tt>  <tt class="py-line"><tt class="py-docstring">        Will add all default chunkhandlers to the chunkhandlers array</tt> </tt>
<a name="L344"></a><tt class="py-lineno">344</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L345"></a><tt class="py-lineno">345</tt>  <tt class="py-line">        <tt class="py-name">c</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">chunkHandlers</tt> </tt>
<a name="L346"></a><tt class="py-lineno">346</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'MAPS'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-108" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.readMAPS()=openttd.savegame.OTTDSaveGameParser-class.html#readMAPS"><a title="openttd.savegame.OTTDSaveGameParser.readMAPS" class="py-name" href="#" onclick="return doclink('link-108', 'readMAPS', 'link-108');">readMAPS</a></tt> </tt>
<a name="L347"></a><tt class="py-lineno">347</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'MAPT'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-109" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.readMAPT()=openttd.savegame.OTTDSaveGameParser-class.html#readMAPT"><a title="openttd.savegame.OTTDSaveGameParser.readMAPT" class="py-name" href="#" onclick="return doclink('link-109', 'readMAPT', 'link-109');">readMAPT</a></tt> </tt>
<a name="L348"></a><tt class="py-lineno">348</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'MAPO'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-110" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.readMAP1()=openttd.savegame.OTTDSaveGameParser-class.html#readMAP1"><a title="openttd.savegame.OTTDSaveGameParser.readMAP1" class="py-name" href="#" onclick="return doclink('link-110', 'readMAP1', 'link-110');">readMAP1</a></tt> </tt>
<a name="L349"></a><tt class="py-lineno">349</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'MAP2'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-111" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.readMAP2()=openttd.savegame.OTTDSaveGameParser-class.html#readMAP2"><a title="openttd.savegame.OTTDSaveGameParser.readMAP2" class="py-name" href="#" onclick="return doclink('link-111', 'readMAP2', 'link-111');">readMAP2</a></tt> </tt>
<a name="L350"></a><tt class="py-lineno">350</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'M3LO'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-112" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.readMAP3()=openttd.savegame.OTTDSaveGameParser-class.html#readMAP3"><a title="openttd.savegame.OTTDSaveGameParser.readMAP3" class="py-name" href="#" onclick="return doclink('link-112', 'readMAP3', 'link-112');">readMAP3</a></tt> </tt>
<a name="L351"></a><tt class="py-lineno">351</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'M3HI'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-113" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.readMAP4()=openttd.savegame.OTTDSaveGameParser-class.html#readMAP4"><a title="openttd.savegame.OTTDSaveGameParser.readMAP4" class="py-name" href="#" onclick="return doclink('link-113', 'readMAP4', 'link-113');">readMAP4</a></tt> </tt>
<a name="L352"></a><tt class="py-lineno">352</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'MAP5'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-114" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.readMAP5()=openttd.savegame.OTTDSaveGameParser-class.html#readMAP5"><a title="openttd.savegame.OTTDSaveGameParser.readMAP5" class="py-name" href="#" onclick="return doclink('link-114', 'readMAP5', 'link-114');">readMAP5</a></tt> </tt>
<a name="L353"></a><tt class="py-lineno">353</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'MAPE'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-115" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.readMAP6()=openttd.savegame.OTTDSaveGameParser-class.html#readMAP6"><a title="openttd.savegame.OTTDSaveGameParser.readMAP6" class="py-name" href="#" onclick="return doclink('link-115', 'readMAP6', 'link-115');">readMAP6</a></tt> </tt>
<a name="L354"></a><tt class="py-lineno">354</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'MAP7'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-116" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.readMAP7()=openttd.savegame.OTTDSaveGameParser-class.html#readMAP7"><a title="openttd.savegame.OTTDSaveGameParser.readMAP7" class="py-name" href="#" onclick="return doclink('link-116', 'readMAP7', 'link-116');">readMAP7</a></tt> </tt>
<a name="L355"></a><tt class="py-lineno">355</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'VIEW'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-117" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.readVIEW()=openttd.savegame.OTTDSaveGameParser-class.html#readVIEW"><a title="openttd.savegame.OTTDSaveGameParser.readVIEW" class="py-name" href="#" onclick="return doclink('link-117', 'readVIEW', 'link-117');">readVIEW</a></tt> </tt>
<a name="L356"></a><tt class="py-lineno">356</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'DATE'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-118" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.readDATE()=openttd.savegame.OTTDSaveGameParser-class.html#readDATE"><a title="openttd.savegame.OTTDSaveGameParser.readDATE" class="py-name" href="#" onclick="return doclink('link-118', 'readDATE', 'link-118');">readDATE</a></tt> </tt>
<a name="L357"></a><tt class="py-lineno">357</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'GLOG'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-119" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.readGLOG()=openttd.savegame.OTTDSaveGameParser-class.html#readGLOG"><a title="openttd.savegame.OTTDSaveGameParser.readGLOG" class="py-name" href="#" onclick="return doclink('link-119', 'readGLOG', 'link-119');">readGLOG</a></tt> </tt>
<a name="L358"></a><tt class="py-lineno">358</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'CHTS'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-120" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.readCHTS()=openttd.savegame.OTTDSaveGameParser-class.html#readCHTS"><a title="openttd.savegame.OTTDSaveGameParser.readCHTS" class="py-name" href="#" onclick="return doclink('link-120', 'readCHTS', 'link-120');">readCHTS</a></tt> </tt>
</div><a name="OTTDSaveGameParser.loadChunks"></a><div id="OTTDSaveGameParser.loadChunks-def"><a name="L359"></a><tt class="py-lineno">359</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.loadChunks-toggle" onclick="return toggle('OTTDSaveGameParser.loadChunks');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#loadChunks">loadChunks</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.loadChunks-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.loadChunks-expanded"><a name="L360"></a><tt class="py-lineno">360</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L361"></a><tt class="py-lineno">361</tt>  <tt class="py-line"><tt class="py-docstring">        Load all chunks from the save and store them in self.chunks</tt> </tt>
<a name="L362"></a><tt class="py-lineno">362</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L363"></a><tt class="py-lineno">363</tt>  <tt class="py-line">        <tt class="py-name">chunks</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L364"></a><tt class="py-lineno">364</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-name">True</tt><tt class="py-op">:</tt> </tt>
<a name="L365"></a><tt class="py-lineno">365</tt>  <tt class="py-line">            <tt class="py-name">curoffs</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-121" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-121', 'offset', 'link-4');">offset</a></tt> </tt>
<a name="L366"></a><tt class="py-lineno">366</tt>  <tt class="py-line">            <tt class="py-name">id</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-122" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint32" class="py-name" href="#" onclick="return doclink('link-122', 'read_uint32', 'link-78');">read_uint32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L367"></a><tt class="py-lineno">367</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">id</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L368"></a><tt class="py-lineno">368</tt>  <tt class="py-line">                <tt class="py-keyword">break</tt> </tt>
<a name="L369"></a><tt class="py-lineno">369</tt>  <tt class="py-line">            <tt id="link-123" class="py-name" targets="Variable sstruct.error.name=sstruct.error-class.html#name"><a title="sstruct.error.name" class="py-name" href="#" onclick="return doclink('link-123', 'name', 'link-123');">name</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"%c%c%c%c"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">id</tt> <tt class="py-op">&gt;&gt;</tt> <tt class="py-number">24</tt> <tt class="py-op">&amp;</tt> <tt class="py-number">0xFF</tt><tt class="py-op">,</tt> <tt class="py-name">id</tt> <tt class="py-op">&gt;&gt;</tt> <tt class="py-number">16</tt> <tt class="py-op">&amp;</tt> <tt class="py-number">0xFF</tt><tt class="py-op">,</tt> <tt class="py-name">id</tt> <tt class="py-op">&gt;&gt;</tt> <tt class="py-number">8</tt> <tt class="py-op">&amp;</tt> <tt class="py-number">0xFF</tt><tt class="py-op">,</tt> <tt class="py-name">id</tt> <tt class="py-op">&amp;</tt> <tt class="py-number">0xFF</tt><tt class="py-op">)</tt> </tt>
<a name="L370"></a><tt class="py-lineno">370</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">verbosity</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">2</tt><tt class="py-op">:</tt> <tt class="py-keyword">print</tt> <tt class="py-string">"loading chunk: %s"</tt><tt class="py-op">%</tt><tt id="link-124" class="py-name"><a title="sstruct.error.name" class="py-name" href="#" onclick="return doclink('link-124', 'name', 'link-123');">name</a></tt> </tt>
<a name="L371"></a><tt class="py-lineno">371</tt>  <tt class="py-line">            <tt class="py-name">m</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-125" class="py-name"><a title="openttd.savegame.CDataPacket.read_byte" class="py-name" href="#" onclick="return doclink('link-125', 'read_byte', 'link-56');">read_byte</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L372"></a><tt class="py-lineno">372</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">m</tt> <tt class="py-op">==</tt> <tt id="link-126" class="py-name"><a title="openttd.constants.saveload_chunk_types" class="py-name" href="#" onclick="return doclink('link-126', 'saveload_chunk_types', 'link-1');">saveload_chunk_types</a></tt><tt class="py-op">[</tt><tt class="py-string">"CH_ARRAY"</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> <tt class="py-comment"># array</tt> </tt>
<a name="L373"></a><tt class="py-lineno">373</tt>  <tt class="py-line">                <tt class="py-name">array</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L374"></a><tt class="py-lineno">374</tt>  <tt class="py-line">                <tt class="py-name">index</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L375"></a><tt class="py-lineno">375</tt>  <tt class="py-line">                <tt class="py-keyword">while</tt> <tt class="py-name">True</tt><tt class="py-op">:</tt> </tt>
<a name="L376"></a><tt class="py-lineno">376</tt>  <tt class="py-line">                    <tt class="py-name">leng</tt>    <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-127" class="py-name" targets="Method openttd.savegame.CDataPacket.read_OTTDSimpleGamma()=openttd.savegame.CDataPacket-class.html#read_OTTDSimpleGamma"><a title="openttd.savegame.CDataPacket.read_OTTDSimpleGamma" class="py-name" href="#" onclick="return doclink('link-127', 'read_OTTDSimpleGamma', 'link-127');">read_OTTDSimpleGamma</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L377"></a><tt class="py-lineno">377</tt>  <tt class="py-line">                    <tt class="py-name">curoffs</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-128" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-128', 'offset', 'link-4');">offset</a></tt> </tt>
<a name="L378"></a><tt class="py-lineno">378</tt>  <tt class="py-line">                    <tt class="py-name">end_offset</tt> <tt class="py-op">=</tt> <tt class="py-name">curoffs</tt> <tt class="py-op">+</tt> <tt class="py-name">leng</tt> <tt class="py-op">-</tt> <tt class="py-number">1</tt>  <tt class="py-comment"># todo: unsure if this is a correct approach ( the -1)</tt> </tt>
<a name="L379"></a><tt class="py-lineno">379</tt>  <tt class="py-line">                    <tt class="py-keyword">if</tt> <tt class="py-name">leng</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L380"></a><tt class="py-lineno">380</tt>  <tt class="py-line">                        <tt class="py-name">end_offset</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-129" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-129', 'offset', 'link-4');">offset</a></tt> </tt>
<a name="L381"></a><tt class="py-lineno">381</tt>  <tt class="py-line">                        <tt class="py-keyword">break</tt> </tt>
<a name="L382"></a><tt class="py-lineno">382</tt>  <tt class="py-line">                    <tt class="py-name">array</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">index</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-130" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-130', 'data', 'link-3');">data</a></tt><tt class="py-op">[</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-131" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-131', 'offset', 'link-4');">offset</a></tt><tt class="py-op">:</tt><tt class="py-name">end_offset</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L383"></a><tt class="py-lineno">383</tt>  <tt class="py-line">                    <tt class="py-name">index</tt> <tt class="py-op">+=</tt> <tt class="py-number">1</tt> </tt>
<a name="L384"></a><tt class="py-lineno">384</tt>  <tt class="py-line">                    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-132" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-132', 'offset', 'link-4');">offset</a></tt> <tt class="py-op">=</tt> <tt class="py-name">end_offset</tt> </tt>
<a name="L385"></a><tt class="py-lineno">385</tt>  <tt class="py-line">                <tt class="py-name">thischunk</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-string">"CH_ARRAY"</tt><tt class="py-op">,</tt> <tt class="py-name">array</tt><tt class="py-op">)</tt> </tt>
<a name="L386"></a><tt class="py-lineno">386</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">m</tt> <tt class="py-op">==</tt> <tt id="link-133" class="py-name"><a title="openttd.constants.saveload_chunk_types" class="py-name" href="#" onclick="return doclink('link-133', 'saveload_chunk_types', 'link-1');">saveload_chunk_types</a></tt><tt class="py-op">[</tt><tt class="py-string">"CH_SPARSE_ARRAY"</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> <tt class="py-comment"># sparse array</tt> </tt>
<a name="L387"></a><tt class="py-lineno">387</tt>  <tt class="py-line">                <tt class="py-name">array</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L388"></a><tt class="py-lineno">388</tt>  <tt class="py-line">                <tt class="py-keyword">while</tt> <tt class="py-name">True</tt><tt class="py-op">:</tt> </tt>
<a name="L389"></a><tt class="py-lineno">389</tt>  <tt class="py-line">                    <tt class="py-name">curoffs</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-134" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-134', 'offset', 'link-4');">offset</a></tt> </tt>
<a name="L390"></a><tt class="py-lineno">390</tt>  <tt class="py-line">                    <tt class="py-name">leng</tt>    <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-135" class="py-name"><a title="openttd.savegame.CDataPacket.read_OTTDSimpleGamma" class="py-name" href="#" onclick="return doclink('link-135', 'read_OTTDSimpleGamma', 'link-127');">read_OTTDSimpleGamma</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L391"></a><tt class="py-lineno">391</tt>  <tt class="py-line">                    <tt class="py-keyword">if</tt> <tt class="py-name">leng</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L392"></a><tt class="py-lineno">392</tt>  <tt class="py-line">                        <tt class="py-name">end_offset</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-136" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-136', 'offset', 'link-4');">offset</a></tt> </tt>
<a name="L393"></a><tt class="py-lineno">393</tt>  <tt class="py-line">                        <tt class="py-keyword">break</tt> </tt>
<a name="L394"></a><tt class="py-lineno">394</tt>  <tt class="py-line">                    <tt class="py-name">index</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-137" class="py-name"><a title="openttd.savegame.CDataPacket.read_OTTDSimpleGamma" class="py-name" href="#" onclick="return doclink('link-137', 'read_OTTDSimpleGamma', 'link-127');">read_OTTDSimpleGamma</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L395"></a><tt class="py-lineno">395</tt>  <tt class="py-line">                    <tt class="py-name">array</tt><tt class="py-op">[</tt><tt class="py-name">index</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-138" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-138', 'data', 'link-3');">data</a></tt><tt class="py-op">[</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-139" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-139', 'offset', 'link-4');">offset</a></tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-name">curoffs</tt><tt class="py-op">+</tt><tt class="py-name">leng</tt><tt class="py-op">)</tt><tt class="py-op">]</tt> </tt>
<a name="L396"></a><tt class="py-lineno">396</tt>  <tt class="py-line">                    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-140" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-140', 'offset', 'link-4');">offset</a></tt> <tt class="py-op">=</tt> <tt class="py-name">curoffs</tt> <tt class="py-op">+</tt> <tt class="py-name">leng</tt> </tt>
<a name="L397"></a><tt class="py-lineno">397</tt>  <tt class="py-line">                <tt class="py-name">thischunk</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-string">"CH_SPARSE_ARRAY"</tt><tt class="py-op">,</tt> <tt class="py-name">array</tt><tt class="py-op">)</tt> </tt>
<a name="L398"></a><tt class="py-lineno">398</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-op">(</tt><tt class="py-name">m</tt> <tt class="py-op">&amp;</tt> <tt class="py-number">0xF</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt id="link-141" class="py-name"><a title="openttd.constants.saveload_chunk_types" class="py-name" href="#" onclick="return doclink('link-141', 'saveload_chunk_types', 'link-1');">saveload_chunk_types</a></tt><tt class="py-op">[</tt><tt class="py-string">"CH_RIFF"</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> <tt class="py-comment"># RIFF</tt> </tt>
<a name="L399"></a><tt class="py-lineno">399</tt>  <tt class="py-line">                <tt class="py-name">leng</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-142" class="py-name"><a title="openttd.savegame.CDataPacket.read_byte" class="py-name" href="#" onclick="return doclink('link-142', 'read_byte', 'link-56');">read_byte</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">&lt;&lt;</tt> <tt class="py-number">16</tt><tt class="py-op">)</tt> <tt class="py-op">|</tt> <tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">m</tt> <tt class="py-op">&gt;&gt;</tt> <tt class="py-number">4</tt><tt class="py-op">)</tt> <tt class="py-op">&lt;&lt;</tt> <tt class="py-number">24</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-143" class="py-name" targets="Method openttd.savegame.CDataPacket.read_uint16()=openttd.savegame.CDataPacket-class.html#read_uint16"><a title="openttd.savegame.CDataPacket.read_uint16" class="py-name" href="#" onclick="return doclink('link-143', 'read_uint16', 'link-143');">read_uint16</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L400"></a><tt class="py-lineno">400</tt>  <tt class="py-line">                <tt class="py-name">end_offset</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-144" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-144', 'offset', 'link-4');">offset</a></tt> <tt class="py-op">+</tt> <tt class="py-name">leng</tt> </tt>
<a name="L401"></a><tt class="py-lineno">401</tt>  <tt class="py-line">                <tt class="py-name">thischunk</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-string">"CH_RIFF"</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-145" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-145', 'data', 'link-3');">data</a></tt><tt class="py-op">[</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-146" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-146', 'offset', 'link-4');">offset</a></tt><tt class="py-op">:</tt><tt class="py-name">end_offset</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L402"></a><tt class="py-lineno">402</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-147" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-147', 'offset', 'link-4');">offset</a></tt> <tt class="py-op">=</tt> <tt class="py-name">end_offset</tt> </tt>
<a name="L403"></a><tt class="py-lineno">403</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L404"></a><tt class="py-lineno">404</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt id="link-148" class="py-name"><a title="openttd.savegame.LoadException" class="py-name" href="#" onclick="return doclink('link-148', 'LoadException', 'link-65');">LoadException</a></tt><tt class="py-op">(</tt><tt class="py-string">"unknown chunk type"</tt><tt class="py-op">)</tt> </tt>
<a name="L405"></a><tt class="py-lineno">405</tt>  <tt class="py-line">            <tt class="py-name">chunks</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt id="link-149" class="py-name"><a title="sstruct.error.name" class="py-name" href="#" onclick="return doclink('link-149', 'name', 'link-123');">name</a></tt><tt class="py-op">,</tt> <tt class="py-name">thischunk</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L406"></a><tt class="py-lineno">406</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">chunks</tt> <tt class="py-op">=</tt> <tt class="py-name">chunks</tt> </tt>
</div><a name="OTTDSaveGameParser.handleChunks"></a><div id="OTTDSaveGameParser.handleChunks-def"><a name="L407"></a><tt class="py-lineno">407</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.handleChunks-toggle" onclick="return toggle('OTTDSaveGameParser.handleChunks');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#handleChunks">handleChunks</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">chunkhandlers</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.handleChunks-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.handleChunks-expanded"><a name="L408"></a><tt class="py-lineno">408</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L409"></a><tt class="py-lineno">409</tt>  <tt class="py-line"><tt class="py-docstring">        Calls handleChunk for every entry in self.chunks</tt> </tt>
<a name="L410"></a><tt class="py-lineno">410</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L411"></a><tt class="py-lineno">411</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">chnk</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">chunks</tt><tt class="py-op">:</tt> </tt>
<a name="L412"></a><tt class="py-lineno">412</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-150" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.handleChunk()=openttd.savegame.OTTDSaveGameParser-class.html#handleChunk"><a title="openttd.savegame.OTTDSaveGameParser.handleChunk" class="py-name" href="#" onclick="return doclink('link-150', 'handleChunk', 'link-150');">handleChunk</a></tt><tt class="py-op">(</tt><tt class="py-name">chnk</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-name">chnk</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-name">chunkhandlers</tt><tt class="py-op">)</tt> </tt>
</div><a name="OTTDSaveGameParser.handleChunk"></a><div id="OTTDSaveGameParser.handleChunk-def"><a name="L413"></a><tt class="py-lineno">413</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.handleChunk-toggle" onclick="return toggle('OTTDSaveGameParser.handleChunk');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#handleChunk">handleChunk</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">name</tt><tt class="py-op">,</tt> <tt class="py-param">chunk</tt><tt class="py-op">,</tt> <tt class="py-param">chunkoverrides</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.handleChunk-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.handleChunk-expanded"><a name="L414"></a><tt class="py-lineno">414</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L415"></a><tt class="py-lineno">415</tt>  <tt class="py-line"><tt class="py-docstring">        Call the chunkhandler for a specific chunk</tt> </tt>
<a name="L416"></a><tt class="py-lineno">416</tt>  <tt class="py-line"><tt class="py-docstring">        @type            name: string</tt> </tt>
<a name="L417"></a><tt class="py-lineno">417</tt>  <tt class="py-line"><tt class="py-docstring">        @type           chunk: raw data string</tt> </tt>
<a name="L418"></a><tt class="py-lineno">418</tt>  <tt class="py-line"><tt class="py-docstring">        @type  chunkoverrides: dict</tt> </tt>
<a name="L419"></a><tt class="py-lineno">419</tt>  <tt class="py-line"><tt class="py-docstring">        @param           name: name of the chunk</tt> </tt>
<a name="L420"></a><tt class="py-lineno">420</tt>  <tt class="py-line"><tt class="py-docstring">        @param          chunk: data to put in a CDataPacket instance and pass to the handler</tt> </tt>
<a name="L421"></a><tt class="py-lineno">421</tt>  <tt class="py-line"><tt class="py-docstring">        @param chunkoverrides: chunkoverrides to pass to findChunkHandler</tt> </tt>
<a name="L422"></a><tt class="py-lineno">422</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L423"></a><tt class="py-lineno">423</tt>  <tt class="py-line">        <tt class="py-name">chunktype</tt> <tt class="py-op">=</tt> <tt class="py-name">chunk</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
<a name="L424"></a><tt class="py-lineno">424</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">verbosity</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt> <tt class="py-keyword">print</tt> <tt class="py-string">"parsing chunk: %s (%s)"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt id="link-151" class="py-name"><a title="sstruct.error.name" class="py-name" href="#" onclick="return doclink('link-151', 'name', 'link-123');">name</a></tt><tt class="py-op">,</tt> <tt class="py-name">chunktype</tt><tt class="py-op">)</tt> </tt>
<a name="L425"></a><tt class="py-lineno">425</tt>  <tt class="py-line">        <tt class="py-name">chunkhandler</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-152" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.findChunkHandler()=openttd.savegame.OTTDSaveGameParser-class.html#findChunkHandler"><a title="openttd.savegame.OTTDSaveGameParser.findChunkHandler" class="py-name" href="#" onclick="return doclink('link-152', 'findChunkHandler', 'link-152');">findChunkHandler</a></tt><tt class="py-op">(</tt><tt id="link-153" class="py-name"><a title="sstruct.error.name" class="py-name" href="#" onclick="return doclink('link-153', 'name', 'link-123');">name</a></tt><tt class="py-op">,</tt> <tt class="py-name">chunkoverrides</tt><tt class="py-op">)</tt> </tt>
<a name="L426"></a><tt class="py-lineno">426</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">chunktype</tt> <tt class="py-op">==</tt> <tt class="py-string">"CH_ARRAY"</tt><tt class="py-op">:</tt> </tt>
<a name="L427"></a><tt class="py-lineno">427</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">listitem</tt> <tt class="py-keyword">in</tt> <tt class="py-name">chunk</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
<a name="L428"></a><tt class="py-lineno">428</tt>  <tt class="py-line">                <tt class="py-name">dp</tt> <tt class="py-op">=</tt> <tt id="link-154" class="py-name"><a title="openttd.savegame.CDataPacket" class="py-name" href="#" onclick="return doclink('link-154', 'CDataPacket', 'link-75');">CDataPacket</a></tt><tt class="py-op">(</tt><tt class="py-name">listitem</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L429"></a><tt class="py-lineno">429</tt>  <tt class="py-line">                <tt class="py-name">chunkhandler</tt><tt class="py-op">(</tt><tt class="py-name">dp</tt><tt class="py-op">,</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-155" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-155', 'size', 'link-2');">size</a></tt><tt class="py-op">,</tt> <tt class="py-name">listitem</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L430"></a><tt class="py-lineno">430</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">chunktype</tt> <tt class="py-op">==</tt> <tt class="py-string">"CH_SPARSE_ARRAY"</tt><tt class="py-op">:</tt> </tt>
<a name="L431"></a><tt class="py-lineno">431</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">listkey</tt> <tt class="py-keyword">in</tt> <tt class="py-name">chunk</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
<a name="L432"></a><tt class="py-lineno">432</tt>  <tt class="py-line">                <tt class="py-name">dp</tt> <tt class="py-op">=</tt> <tt id="link-156" class="py-name"><a title="openttd.savegame.CDataPacket" class="py-name" href="#" onclick="return doclink('link-156', 'CDataPacket', 'link-75');">CDataPacket</a></tt><tt class="py-op">(</tt><tt class="py-name">chunk</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-name">listkey</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L433"></a><tt class="py-lineno">433</tt>  <tt class="py-line">                <tt class="py-name">chunkhandler</tt><tt class="py-op">(</tt><tt class="py-name">dp</tt><tt class="py-op">,</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-157" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-157', 'size', 'link-2');">size</a></tt><tt class="py-op">,</tt> <tt class="py-name">listkey</tt><tt class="py-op">)</tt> </tt>
<a name="L434"></a><tt class="py-lineno">434</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">chunktype</tt> <tt class="py-op">==</tt> <tt class="py-string">"CH_RIFF"</tt><tt class="py-op">:</tt> </tt>
<a name="L435"></a><tt class="py-lineno">435</tt>  <tt class="py-line">            <tt class="py-name">dp</tt> <tt class="py-op">=</tt> <tt id="link-158" class="py-name"><a title="openttd.savegame.CDataPacket" class="py-name" href="#" onclick="return doclink('link-158', 'CDataPacket', 'link-75');">CDataPacket</a></tt><tt class="py-op">(</tt><tt class="py-name">chunk</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L436"></a><tt class="py-lineno">436</tt>  <tt class="py-line">            <tt class="py-name">chunkhandler</tt><tt class="py-op">(</tt><tt class="py-name">dp</tt><tt class="py-op">,</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-159" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-159', 'size', 'link-2');">size</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L437"></a><tt class="py-lineno">437</tt>  <tt class="py-line">    <tt class="py-comment"># chunk handlers |/// -- start --</tt> </tt>
<a name="OTTDSaveGameParser.readMAPS"></a><div id="OTTDSaveGameParser.readMAPS-def"><a name="L438"></a><tt class="py-lineno">438</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.readMAPS-toggle" onclick="return toggle('OTTDSaveGameParser.readMAPS');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#readMAPS">readMAPS</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">dp</tt><tt class="py-op">,</tt> <tt class="py-param">chunksize</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.readMAPS-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.readMAPS-expanded"><a name="L439"></a><tt class="py-lineno">439</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_version</tt> <tt class="py-op">&gt;=</tt> <tt class="py-number">6</tt><tt class="py-op">:</tt> </tt>
<a name="L440"></a><tt class="py-lineno">440</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt><tt class="py-op">[</tt><tt class="py-string">'x'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-160" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint32" class="py-name" href="#" onclick="return doclink('link-160', 'read_uint32', 'link-78');">read_uint32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L441"></a><tt class="py-lineno">441</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt><tt class="py-op">[</tt><tt class="py-string">'y'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-161" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint32" class="py-name" href="#" onclick="return doclink('link-161', 'read_uint32', 'link-78');">read_uint32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L442"></a><tt class="py-lineno">442</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt><tt class="py-op">[</tt><tt class="py-string">'known'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">True</tt> </tt>
<a name="L443"></a><tt class="py-lineno">443</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt><tt class="py-op">[</tt><tt class="py-string">'total'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt><tt class="py-op">[</tt><tt class="py-string">'x'</tt><tt class="py-op">]</tt> <tt class="py-op">*</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt><tt class="py-op">[</tt><tt class="py-string">'y'</tt><tt class="py-op">]</tt> </tt>
</div><a name="OTTDSaveGameParser.readMAPT"></a><div id="OTTDSaveGameParser.readMAPT-def"><a name="L444"></a><tt class="py-lineno">444</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.readMAPT-toggle" onclick="return toggle('OTTDSaveGameParser.readMAPT');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#readMAPT">readMAPT</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">dp</tt><tt class="py-op">,</tt> <tt class="py-param">chunksize</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.readMAPT-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.readMAPT-expanded"><a name="L445"></a><tt class="py-lineno">445</tt>  <tt class="py-line">        <tt class="py-name">type_height</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L446"></a><tt class="py-lineno">446</tt>  <tt class="py-line">        <tt id="link-162" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-162', 'size', 'link-2');">size</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt><tt class="py-op">[</tt><tt class="py-string">'total'</tt><tt class="py-op">]</tt> </tt>
<a name="L447"></a><tt class="py-lineno">447</tt>  <tt class="py-line">        <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L448"></a><tt class="py-lineno">448</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-name">i</tt> <tt class="py-op">&lt;</tt> <tt id="link-163" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-163', 'size', 'link-2');">size</a></tt><tt class="py-op">:</tt> </tt>
<a name="L449"></a><tt class="py-lineno">449</tt>  <tt class="py-line">            <tt class="py-name">type_height</tt><tt class="py-op">.</tt><tt class="py-name">extend</tt><tt class="py-op">(</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-164" class="py-name" targets="Method openttd.savegame.CDataPacket.read_array()=openttd.savegame.CDataPacket-class.html#read_array"><a title="openttd.savegame.CDataPacket.read_array" class="py-name" href="#" onclick="return doclink('link-164', 'read_array', 'link-164');">read_array</a></tt><tt class="py-op">(</tt><tt class="py-string">'B'</tt><tt class="py-op">,</tt> <tt class="py-number">4096</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L450"></a><tt class="py-lineno">450</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">+=</tt> <tt class="py-number">4096</tt> </tt>
<a name="L451"></a><tt class="py-lineno">451</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">map_array</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L452"></a><tt class="py-lineno">452</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">map_array</tt><tt class="py-op">[</tt><tt class="py-string">'t'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">type_height</tt> </tt>
</div><a name="OTTDSaveGameParser.readMAP1"></a><div id="OTTDSaveGameParser.readMAP1-def"><a name="L453"></a><tt class="py-lineno">453</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.readMAP1-toggle" onclick="return toggle('OTTDSaveGameParser.readMAP1');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#readMAP1">readMAP1</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">dp</tt><tt class="py-op">,</tt> <tt class="py-param">chunksize</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.readMAP1-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.readMAP1-expanded"><a name="L454"></a><tt class="py-lineno">454</tt>  <tt class="py-line">        <tt class="py-name">m1</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L455"></a><tt class="py-lineno">455</tt>  <tt class="py-line">        <tt id="link-165" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-165', 'size', 'link-2');">size</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt><tt class="py-op">[</tt><tt class="py-string">'total'</tt><tt class="py-op">]</tt> </tt>
<a name="L456"></a><tt class="py-lineno">456</tt>  <tt class="py-line">        <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L457"></a><tt class="py-lineno">457</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-name">i</tt> <tt class="py-op">&lt;</tt> <tt id="link-166" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-166', 'size', 'link-2');">size</a></tt><tt class="py-op">:</tt> </tt>
<a name="L458"></a><tt class="py-lineno">458</tt>  <tt class="py-line">            <tt class="py-name">m1</tt><tt class="py-op">.</tt><tt class="py-name">extend</tt><tt class="py-op">(</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-167" class="py-name" targets="Method openttd.savegame.CDataPacket.read_bytes()=openttd.savegame.CDataPacket-class.html#read_bytes"><a title="openttd.savegame.CDataPacket.read_bytes" class="py-name" href="#" onclick="return doclink('link-167', 'read_bytes', 'link-167');">read_bytes</a></tt><tt class="py-op">(</tt><tt class="py-number">4096</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L459"></a><tt class="py-lineno">459</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">+=</tt> <tt class="py-number">4096</tt> </tt>
<a name="L460"></a><tt class="py-lineno">460</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">map_array</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">m1</tt> </tt>
</div><a name="OTTDSaveGameParser.readMAP2"></a><div id="OTTDSaveGameParser.readMAP2-def"><a name="L461"></a><tt class="py-lineno">461</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.readMAP2-toggle" onclick="return toggle('OTTDSaveGameParser.readMAP2');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#readMAP2">readMAP2</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">dp</tt><tt class="py-op">,</tt> <tt class="py-param">chunksize</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.readMAP2-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.readMAP2-expanded"><a name="L462"></a><tt class="py-lineno">462</tt>  <tt class="py-line">        <tt class="py-name">m2</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L463"></a><tt class="py-lineno">463</tt>  <tt class="py-line">        <tt id="link-168" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-168', 'size', 'link-2');">size</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt><tt class="py-op">[</tt><tt class="py-string">'total'</tt><tt class="py-op">]</tt> </tt>
<a name="L464"></a><tt class="py-lineno">464</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_version</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">5</tt><tt class="py-op">:</tt> </tt>
<a name="L465"></a><tt class="py-lineno">465</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L466"></a><tt class="py-lineno">466</tt>  <tt class="py-line">            <tt class="py-keyword">while</tt> <tt class="py-name">i</tt> <tt class="py-op">&lt;</tt> <tt id="link-169" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-169', 'size', 'link-2');">size</a></tt><tt class="py-op">:</tt> </tt>
<a name="L467"></a><tt class="py-lineno">467</tt>  <tt class="py-line">                <tt class="py-name">m2</tt><tt class="py-op">.</tt><tt class="py-name">extend</tt><tt class="py-op">(</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-170" class="py-name"><a title="openttd.savegame.CDataPacket.read_array" class="py-name" href="#" onclick="return doclink('link-170', 'read_array', 'link-164');">read_array</a></tt><tt class="py-op">(</tt><tt class="py-string">'H'</tt><tt class="py-op">,</tt> <tt class="py-number">4096</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L468"></a><tt class="py-lineno">468</tt>  <tt class="py-line">                <tt class="py-name">i</tt> <tt class="py-op">+=</tt> <tt class="py-number">4096</tt> </tt>
<a name="L469"></a><tt class="py-lineno">469</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L470"></a><tt class="py-lineno">470</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L471"></a><tt class="py-lineno">471</tt>  <tt class="py-line">            <tt class="py-keyword">while</tt> <tt class="py-name">i</tt> <tt class="py-op">&lt;</tt> <tt id="link-171" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-171', 'size', 'link-2');">size</a></tt><tt class="py-op">:</tt> </tt>
<a name="L472"></a><tt class="py-lineno">472</tt>  <tt class="py-line">                <tt class="py-name">m2</tt><tt class="py-op">.</tt><tt class="py-name">extend</tt><tt class="py-op">(</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-172" class="py-name"><a title="openttd.savegame.CDataPacket.read_array" class="py-name" href="#" onclick="return doclink('link-172', 'read_array', 'link-164');">read_array</a></tt><tt class="py-op">(</tt><tt class="py-string">'B'</tt><tt class="py-op">,</tt> <tt class="py-number">4096</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L473"></a><tt class="py-lineno">473</tt>  <tt class="py-line">                <tt class="py-name">i</tt> <tt class="py-op">+=</tt> <tt class="py-number">4096</tt> </tt>
<a name="L474"></a><tt class="py-lineno">474</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">map_array</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">m2</tt> </tt>
</div><a name="OTTDSaveGameParser.readMAP3"></a><div id="OTTDSaveGameParser.readMAP3-def"><a name="L475"></a><tt class="py-lineno">475</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.readMAP3-toggle" onclick="return toggle('OTTDSaveGameParser.readMAP3');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#readMAP3">readMAP3</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">dp</tt><tt class="py-op">,</tt> <tt class="py-param">chunksize</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.readMAP3-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.readMAP3-expanded"><a name="L476"></a><tt class="py-lineno">476</tt>  <tt class="py-line">        <tt class="py-name">m3</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L477"></a><tt class="py-lineno">477</tt>  <tt class="py-line">        <tt id="link-173" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-173', 'size', 'link-2');">size</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt><tt class="py-op">[</tt><tt class="py-string">'total'</tt><tt class="py-op">]</tt> </tt>
<a name="L478"></a><tt class="py-lineno">478</tt>  <tt class="py-line">        <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L479"></a><tt class="py-lineno">479</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-name">i</tt> <tt class="py-op">&lt;</tt> <tt id="link-174" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-174', 'size', 'link-2');">size</a></tt><tt class="py-op">:</tt> </tt>
<a name="L480"></a><tt class="py-lineno">480</tt>  <tt class="py-line">            <tt class="py-name">m3</tt><tt class="py-op">.</tt><tt class="py-name">extend</tt><tt class="py-op">(</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-175" class="py-name"><a title="openttd.savegame.CDataPacket.read_array" class="py-name" href="#" onclick="return doclink('link-175', 'read_array', 'link-164');">read_array</a></tt><tt class="py-op">(</tt><tt class="py-string">'B'</tt><tt class="py-op">,</tt> <tt class="py-number">4096</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L481"></a><tt class="py-lineno">481</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">+=</tt> <tt class="py-number">4096</tt> </tt>
<a name="L482"></a><tt class="py-lineno">482</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">map_array</tt><tt class="py-op">[</tt><tt class="py-number">3</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">m3</tt> </tt>
</div><a name="L483"></a><tt class="py-lineno">483</tt>  <tt class="py-line">                 </tt>
<a name="OTTDSaveGameParser.readMAP4"></a><div id="OTTDSaveGameParser.readMAP4-def"><a name="L484"></a><tt class="py-lineno">484</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.readMAP4-toggle" onclick="return toggle('OTTDSaveGameParser.readMAP4');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#readMAP4">readMAP4</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">dp</tt><tt class="py-op">,</tt> <tt class="py-param">chunksize</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.readMAP4-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.readMAP4-expanded"><a name="L485"></a><tt class="py-lineno">485</tt>  <tt class="py-line">        <tt class="py-name">m4</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L486"></a><tt class="py-lineno">486</tt>  <tt class="py-line">        <tt id="link-176" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-176', 'size', 'link-2');">size</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt><tt class="py-op">[</tt><tt class="py-string">'total'</tt><tt class="py-op">]</tt> </tt>
<a name="L487"></a><tt class="py-lineno">487</tt>  <tt class="py-line">        <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L488"></a><tt class="py-lineno">488</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-name">i</tt> <tt class="py-op">&lt;</tt> <tt id="link-177" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-177', 'size', 'link-2');">size</a></tt><tt class="py-op">:</tt> </tt>
<a name="L489"></a><tt class="py-lineno">489</tt>  <tt class="py-line">            <tt class="py-name">m4</tt><tt class="py-op">.</tt><tt class="py-name">extend</tt><tt class="py-op">(</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-178" class="py-name"><a title="openttd.savegame.CDataPacket.read_array" class="py-name" href="#" onclick="return doclink('link-178', 'read_array', 'link-164');">read_array</a></tt><tt class="py-op">(</tt><tt class="py-string">'B'</tt><tt class="py-op">,</tt> <tt class="py-number">4096</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L490"></a><tt class="py-lineno">490</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">+=</tt> <tt class="py-number">4096</tt> </tt>
<a name="L491"></a><tt class="py-lineno">491</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">map_array</tt><tt class="py-op">[</tt><tt class="py-number">4</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">m4</tt> </tt>
</div><a name="L492"></a><tt class="py-lineno">492</tt>  <tt class="py-line">                 </tt>
<a name="OTTDSaveGameParser.readMAP5"></a><div id="OTTDSaveGameParser.readMAP5-def"><a name="L493"></a><tt class="py-lineno">493</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.readMAP5-toggle" onclick="return toggle('OTTDSaveGameParser.readMAP5');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#readMAP5">readMAP5</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">dp</tt><tt class="py-op">,</tt> <tt class="py-param">chunksize</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.readMAP5-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.readMAP5-expanded"><a name="L494"></a><tt class="py-lineno">494</tt>  <tt class="py-line">        <tt class="py-name">m5</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L495"></a><tt class="py-lineno">495</tt>  <tt class="py-line">        <tt id="link-179" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-179', 'size', 'link-2');">size</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt><tt class="py-op">[</tt><tt class="py-string">'total'</tt><tt class="py-op">]</tt> </tt>
<a name="L496"></a><tt class="py-lineno">496</tt>  <tt class="py-line">        <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L497"></a><tt class="py-lineno">497</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-name">i</tt> <tt class="py-op">&lt;</tt> <tt id="link-180" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-180', 'size', 'link-2');">size</a></tt><tt class="py-op">:</tt> </tt>
<a name="L498"></a><tt class="py-lineno">498</tt>  <tt class="py-line">            <tt class="py-name">m5</tt><tt class="py-op">.</tt><tt class="py-name">extend</tt><tt class="py-op">(</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-181" class="py-name"><a title="openttd.savegame.CDataPacket.read_array" class="py-name" href="#" onclick="return doclink('link-181', 'read_array', 'link-164');">read_array</a></tt><tt class="py-op">(</tt><tt class="py-string">'B'</tt><tt class="py-op">,</tt> <tt class="py-number">4096</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L499"></a><tt class="py-lineno">499</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">+=</tt> <tt class="py-number">4096</tt> </tt>
<a name="L500"></a><tt class="py-lineno">500</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">map_array</tt><tt class="py-op">[</tt><tt class="py-number">5</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">m5</tt> </tt>
</div><a name="OTTDSaveGameParser.readMAP6"></a><div id="OTTDSaveGameParser.readMAP6-def"><a name="L501"></a><tt class="py-lineno">501</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.readMAP6-toggle" onclick="return toggle('OTTDSaveGameParser.readMAP6');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#readMAP6">readMAP6</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">dp</tt><tt class="py-op">,</tt> <tt class="py-param">chunksize</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.readMAP6-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.readMAP6-expanded"><a name="L502"></a><tt class="py-lineno">502</tt>  <tt class="py-line">        <tt class="py-name">GB</tt> <tt class="py-op">=</tt> <tt class="py-keyword">lambda</tt> <tt class="py-name">x</tt><tt class="py-op">,</tt><tt class="py-name">s</tt><tt class="py-op">,</tt><tt class="py-name">n</tt><tt class="py-op">:</tt> <tt class="py-op">(</tt><tt class="py-name">x</tt> <tt class="py-op">&gt;&gt;</tt> <tt class="py-name">s</tt><tt class="py-op">)</tt> <tt class="py-op">&amp;</tt> <tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-number">1</tt> <tt class="py-op">&lt;&lt;</tt> <tt class="py-name">n</tt><tt class="py-op">)</tt> <tt class="py-op">-</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
<a name="L503"></a><tt class="py-lineno">503</tt>  <tt class="py-line">        <tt class="py-name">m6</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L504"></a><tt class="py-lineno">504</tt>  <tt class="py-line">        <tt id="link-182" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-182', 'size', 'link-2');">size</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt><tt class="py-op">[</tt><tt class="py-string">'total'</tt><tt class="py-op">]</tt> </tt>
<a name="L505"></a><tt class="py-lineno">505</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_version</tt> <tt class="py-op">&lt;=</tt> <tt class="py-number">42</tt><tt class="py-op">:</tt> </tt>
<a name="L506"></a><tt class="py-lineno">506</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L507"></a><tt class="py-lineno">507</tt>  <tt class="py-line">            <tt class="py-keyword">while</tt> <tt class="py-name">i</tt> <tt class="py-op">&lt;</tt> <tt id="link-183" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-183', 'size', 'link-2');">size</a></tt><tt class="py-op">:</tt> </tt>
<a name="L508"></a><tt class="py-lineno">508</tt>  <tt class="py-line">                <tt class="py-name">j</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L509"></a><tt class="py-lineno">509</tt>  <tt class="py-line">                <tt class="py-keyword">while</tt> <tt class="py-name">j</tt> <tt class="py-op">!=</tt> <tt class="py-number">1024</tt><tt class="py-op">:</tt> </tt>
<a name="L510"></a><tt class="py-lineno">510</tt>  <tt class="py-line">                    <tt class="py-name">buf</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-184" class="py-name"><a title="openttd.savegame.CDataPacket.read_byte" class="py-name" href="#" onclick="return doclink('link-184', 'read_byte', 'link-56');">read_byte</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L511"></a><tt class="py-lineno">511</tt>  <tt class="py-line">                    <tt class="py-name">m6</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">GB</tt><tt class="py-op">(</tt><tt class="py-name">buf</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-number">2</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L512"></a><tt class="py-lineno">512</tt>  <tt class="py-line">                    <tt class="py-name">m6</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">GB</tt><tt class="py-op">(</tt><tt class="py-name">buf</tt><tt class="py-op">,</tt> <tt class="py-number">2</tt><tt class="py-op">,</tt> <tt class="py-number">2</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L513"></a><tt class="py-lineno">513</tt>  <tt class="py-line">                    <tt class="py-name">m6</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">GB</tt><tt class="py-op">(</tt><tt class="py-name">buf</tt><tt class="py-op">,</tt> <tt class="py-number">4</tt><tt class="py-op">,</tt> <tt class="py-number">2</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L514"></a><tt class="py-lineno">514</tt>  <tt class="py-line">                    <tt class="py-name">m6</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">GB</tt><tt class="py-op">(</tt><tt class="py-name">buf</tt><tt class="py-op">,</tt> <tt class="py-number">6</tt><tt class="py-op">,</tt> <tt class="py-number">2</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L515"></a><tt class="py-lineno">515</tt>  <tt class="py-line">                    <tt class="py-name">i</tt> <tt class="py-op">+=</tt> <tt class="py-number">4</tt> </tt>
<a name="L516"></a><tt class="py-lineno">516</tt>  <tt class="py-line">                    <tt class="py-name">j</tt> <tt class="py-op">+=</tt> <tt class="py-number">1</tt> </tt>
<a name="L517"></a><tt class="py-lineno">517</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L518"></a><tt class="py-lineno">518</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L519"></a><tt class="py-lineno">519</tt>  <tt class="py-line">            <tt class="py-keyword">while</tt> <tt class="py-name">i</tt> <tt class="py-op">&lt;</tt> <tt id="link-185" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-185', 'size', 'link-2');">size</a></tt><tt class="py-op">:</tt> </tt>
<a name="L520"></a><tt class="py-lineno">520</tt>  <tt class="py-line">                <tt class="py-name">m6</tt><tt class="py-op">.</tt><tt class="py-name">extend</tt><tt class="py-op">(</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-186" class="py-name"><a title="openttd.savegame.CDataPacket.read_array" class="py-name" href="#" onclick="return doclink('link-186', 'read_array', 'link-164');">read_array</a></tt><tt class="py-op">(</tt><tt class="py-string">'B'</tt><tt class="py-op">,</tt> <tt class="py-number">4096</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L521"></a><tt class="py-lineno">521</tt>  <tt class="py-line">                <tt class="py-name">i</tt> <tt class="py-op">+=</tt> <tt class="py-number">4096</tt> </tt>
<a name="L522"></a><tt class="py-lineno">522</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">map_array</tt><tt class="py-op">[</tt><tt class="py-number">6</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">m6</tt> </tt>
</div><a name="OTTDSaveGameParser.readMAP7"></a><div id="OTTDSaveGameParser.readMAP7-def"><a name="L523"></a><tt class="py-lineno">523</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.readMAP7-toggle" onclick="return toggle('OTTDSaveGameParser.readMAP7');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#readMAP7">readMAP7</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">dp</tt><tt class="py-op">,</tt> <tt class="py-param">chunksize</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.readMAP7-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.readMAP7-expanded"><a name="L524"></a><tt class="py-lineno">524</tt>  <tt class="py-line">        <tt class="py-name">m7</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L525"></a><tt class="py-lineno">525</tt>  <tt class="py-line">        <tt id="link-187" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-187', 'size', 'link-2');">size</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt><tt class="py-op">[</tt><tt class="py-string">'total'</tt><tt class="py-op">]</tt> </tt>
<a name="L526"></a><tt class="py-lineno">526</tt>  <tt class="py-line">        <tt class="py-name">i</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L527"></a><tt class="py-lineno">527</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-name">i</tt> <tt class="py-op">&lt;</tt> <tt id="link-188" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-188', 'size', 'link-2');">size</a></tt><tt class="py-op">:</tt> </tt>
<a name="L528"></a><tt class="py-lineno">528</tt>  <tt class="py-line">            <tt class="py-name">m7</tt><tt class="py-op">.</tt><tt class="py-name">extend</tt><tt class="py-op">(</tt><tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-189" class="py-name"><a title="openttd.savegame.CDataPacket.read_array" class="py-name" href="#" onclick="return doclink('link-189', 'read_array', 'link-164');">read_array</a></tt><tt class="py-op">(</tt><tt class="py-string">'B'</tt><tt class="py-op">,</tt> <tt class="py-number">4096</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L529"></a><tt class="py-lineno">529</tt>  <tt class="py-line">            <tt class="py-name">i</tt> <tt class="py-op">+=</tt> <tt class="py-number">4096</tt> </tt>
<a name="L530"></a><tt class="py-lineno">530</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">map_array</tt><tt class="py-op">[</tt><tt class="py-number">7</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">m7</tt> </tt>
</div><a name="OTTDSaveGameParser.readVIEW"></a><div id="OTTDSaveGameParser.readVIEW-def"><a name="L531"></a><tt class="py-lineno">531</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.readVIEW-toggle" onclick="return toggle('OTTDSaveGameParser.readVIEW');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#readVIEW">readVIEW</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">dp</tt><tt class="py-op">,</tt> <tt class="py-param">chunksize</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.readVIEW-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.readVIEW-expanded"><a name="L532"></a><tt class="py-lineno">532</tt>  <tt class="py-line">        <tt class="py-name">view</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L533"></a><tt class="py-lineno">533</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_version</tt> <tt class="py-op">&lt;=</tt> <tt class="py-number">5</tt><tt class="py-op">:</tt> </tt>
<a name="L534"></a><tt class="py-lineno">534</tt>  <tt class="py-line">            <tt class="py-name">view</tt><tt class="py-op">[</tt><tt class="py-string">'x'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-190" class="py-name" targets="Method openttd.savegame.CDataPacket.read_int16()=openttd.savegame.CDataPacket-class.html#read_int16"><a title="openttd.savegame.CDataPacket.read_int16" class="py-name" href="#" onclick="return doclink('link-190', 'read_int16', 'link-190');">read_int16</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L535"></a><tt class="py-lineno">535</tt>  <tt class="py-line">            <tt class="py-name">view</tt><tt class="py-op">[</tt><tt class="py-string">'y'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-191" class="py-name"><a title="openttd.savegame.CDataPacket.read_int16" class="py-name" href="#" onclick="return doclink('link-191', 'read_int16', 'link-190');">read_int16</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L536"></a><tt class="py-lineno">536</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L537"></a><tt class="py-lineno">537</tt>  <tt class="py-line">            <tt class="py-name">view</tt><tt class="py-op">[</tt><tt class="py-string">'x'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-192" class="py-name" targets="Method openttd.savegame.CDataPacket.read_int32()=openttd.savegame.CDataPacket-class.html#read_int32"><a title="openttd.savegame.CDataPacket.read_int32" class="py-name" href="#" onclick="return doclink('link-192', 'read_int32', 'link-192');">read_int32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L538"></a><tt class="py-lineno">538</tt>  <tt class="py-line">            <tt class="py-name">view</tt><tt class="py-op">[</tt><tt class="py-string">'y'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-193" class="py-name"><a title="openttd.savegame.CDataPacket.read_int32" class="py-name" href="#" onclick="return doclink('link-193', 'read_int32', 'link-192');">read_int32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L539"></a><tt class="py-lineno">539</tt>  <tt class="py-line">        <tt class="py-name">view</tt><tt class="py-op">[</tt><tt class="py-string">'z'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-194" class="py-name" targets="Method openttd.savegame.CDataPacket.read_uint8()=openttd.savegame.CDataPacket-class.html#read_uint8"><a title="openttd.savegame.CDataPacket.read_uint8" class="py-name" href="#" onclick="return doclink('link-194', 'read_uint8', 'link-194');">read_uint8</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L540"></a><tt class="py-lineno">540</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">view</tt> <tt class="py-op">=</tt> <tt class="py-name">view</tt> </tt>
</div><a name="OTTDSaveGameParser.readDATE"></a><div id="OTTDSaveGameParser.readDATE-def"><a name="L541"></a><tt class="py-lineno">541</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.readDATE-toggle" onclick="return toggle('OTTDSaveGameParser.readDATE');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#readDATE">readDATE</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">dp</tt><tt class="py-op">,</tt> <tt class="py-param">chunksize</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.readDATE-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.readDATE-expanded"><a name="L542"></a><tt class="py-lineno">542</tt>  <tt class="py-line">        <tt id="link-195" class="py-name" targets="Module openttd.date=openttd.date-module.html"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-195', 'date', 'link-195');">date</a></tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L543"></a><tt class="py-lineno">543</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_version</tt> <tt class="py-op">&lt;=</tt> <tt class="py-number">30</tt><tt class="py-op">:</tt> </tt>
<a name="L544"></a><tt class="py-lineno">544</tt>  <tt class="py-line">            <tt id="link-196" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-196', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'date'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-197" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint16" class="py-name" href="#" onclick="return doclink('link-197', 'read_uint16', 'link-143');">read_uint16</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L545"></a><tt class="py-lineno">545</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L546"></a><tt class="py-lineno">546</tt>  <tt class="py-line">            <tt id="link-198" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-198', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'date'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-199" class="py-name"><a title="openttd.savegame.CDataPacket.read_int32" class="py-name" href="#" onclick="return doclink('link-199', 'read_int32', 'link-192');">read_int32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L547"></a><tt class="py-lineno">547</tt>  <tt class="py-line">        <tt id="link-200" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-200', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'date_fract'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-201" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint16" class="py-name" href="#" onclick="return doclink('link-201', 'read_uint16', 'link-143');">read_uint16</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L548"></a><tt class="py-lineno">548</tt>  <tt class="py-line">        <tt id="link-202" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-202', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'tick_counter'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-203" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint16" class="py-name" href="#" onclick="return doclink('link-203', 'read_uint16', 'link-143');">read_uint16</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L549"></a><tt class="py-lineno">549</tt>  <tt class="py-line">        <tt id="link-204" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-204', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'vehicle_id_ctr_day'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-205" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint16" class="py-name" href="#" onclick="return doclink('link-205', 'read_uint16', 'link-143');">read_uint16</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L550"></a><tt class="py-lineno">550</tt>  <tt class="py-line">        <tt id="link-206" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-206', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'age_cargo_skip_counter'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-207" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint8" class="py-name" href="#" onclick="return doclink('link-207', 'read_uint8', 'link-194');">read_uint8</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L551"></a><tt class="py-lineno">551</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_version</tt> <tt class="py-op">&lt;=</tt> <tt class="py-number">45</tt><tt class="py-op">:</tt> </tt>
<a name="L552"></a><tt class="py-lineno">552</tt>  <tt class="py-line">            <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-208" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-208', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'x'</tt><tt class="py-op">)</tt> </tt>
<a name="L553"></a><tt class="py-lineno">553</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_version</tt> <tt class="py-op">&lt;=</tt> <tt class="py-number">5</tt><tt class="py-op">:</tt> </tt>
<a name="L554"></a><tt class="py-lineno">554</tt>  <tt class="py-line">            <tt id="link-209" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-209', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'cur_tileloop_tile'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-210" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint16" class="py-name" href="#" onclick="return doclink('link-210', 'read_uint16', 'link-143');">read_uint16</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L555"></a><tt class="py-lineno">555</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L556"></a><tt class="py-lineno">556</tt>  <tt class="py-line">            <tt id="link-211" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-211', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'cur_tileloop_tile'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-212" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint32" class="py-name" href="#" onclick="return doclink('link-212', 'read_uint32', 'link-78');">read_uint32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L557"></a><tt class="py-lineno">557</tt>  <tt class="py-line">        <tt id="link-213" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-213', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'disaster_delay'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-214" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint16" class="py-name" href="#" onclick="return doclink('link-214', 'read_uint16', 'link-143');">read_uint16</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L558"></a><tt class="py-lineno">558</tt>  <tt class="py-line">        <tt id="link-215" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-215', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'station_tick_ctr'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-216" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint16" class="py-name" href="#" onclick="return doclink('link-216', 'read_uint16', 'link-143');">read_uint16</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L559"></a><tt class="py-lineno">559</tt>  <tt class="py-line">        <tt id="link-217" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-217', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'random_state1'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-218" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint32" class="py-name" href="#" onclick="return doclink('link-218', 'read_uint32', 'link-78');">read_uint32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L560"></a><tt class="py-lineno">560</tt>  <tt class="py-line">        <tt id="link-219" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-219', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'random_state2'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-220" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint32" class="py-name" href="#" onclick="return doclink('link-220', 'read_uint32', 'link-78');">read_uint32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L561"></a><tt class="py-lineno">561</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_version</tt> <tt class="py-op">&lt;=</tt> <tt class="py-number">9</tt><tt class="py-op">:</tt> </tt>
<a name="L562"></a><tt class="py-lineno">562</tt>  <tt class="py-line">            <tt id="link-221" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-221', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'cur_town_ctr'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-222" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint8" class="py-name" href="#" onclick="return doclink('link-222', 'read_uint8', 'link-194');">read_uint8</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L563"></a><tt class="py-lineno">563</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L564"></a><tt class="py-lineno">564</tt>  <tt class="py-line">            <tt id="link-223" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-223', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'cur_town_ctr'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-224" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint32" class="py-name" href="#" onclick="return doclink('link-224', 'read_uint32', 'link-78');">read_uint32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L565"></a><tt class="py-lineno">565</tt>  <tt class="py-line">        <tt id="link-225" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-225', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'cur_player_tick_index'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-226" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint8" class="py-name" href="#" onclick="return doclink('link-226', 'read_uint8', 'link-194');">read_uint8</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L566"></a><tt class="py-lineno">566</tt>  <tt class="py-line">        <tt id="link-227" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-227', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'next_competitor_start'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-228" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint16" class="py-name" href="#" onclick="return doclink('link-228', 'read_uint16', 'link-143');">read_uint16</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L567"></a><tt class="py-lineno">567</tt>  <tt class="py-line">        <tt id="link-229" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-229', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'trees_tick_ctr'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-230" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint8" class="py-name" href="#" onclick="return doclink('link-230', 'read_uint8', 'link-194');">read_uint8</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L568"></a><tt class="py-lineno">568</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_version</tt> <tt class="py-op">&gt;=</tt> <tt class="py-number">4</tt><tt class="py-op">:</tt> </tt>
<a name="L569"></a><tt class="py-lineno">569</tt>  <tt class="py-line">            <tt id="link-231" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-231', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'pause_game'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-232" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint8" class="py-name" href="#" onclick="return doclink('link-232', 'read_uint8', 'link-194');">read_uint8</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L570"></a><tt class="py-lineno">570</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">saveload_version</tt> <tt class="py-op">&gt;=</tt> <tt class="py-number">11</tt><tt class="py-op">:</tt> </tt>
<a name="L571"></a><tt class="py-lineno">571</tt>  <tt class="py-line">            <tt id="link-233" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-233', 'date', 'link-195');">date</a></tt><tt class="py-op">[</tt><tt class="py-string">'cur_town_iter'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-234" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint32" class="py-name" href="#" onclick="return doclink('link-234', 'read_uint32', 'link-78');">read_uint32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L572"></a><tt class="py-lineno">572</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-235" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-235', 'date', 'link-195');">date</a></tt> <tt class="py-op">=</tt> <tt id="link-236" class="py-name"><a title="openttd.date" class="py-name" href="#" onclick="return doclink('link-236', 'date', 'link-195');">date</a></tt> </tt>
</div><a name="OTTDSaveGameParser.readGLOG"></a><div id="OTTDSaveGameParser.readGLOG-def"><a name="L573"></a><tt class="py-lineno">573</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.readGLOG-toggle" onclick="return toggle('OTTDSaveGameParser.readGLOG');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#readGLOG">readGLOG</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">dp</tt><tt class="py-op">,</tt> <tt class="py-param">chunksize</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.readGLOG-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.readGLOG-expanded"><a name="L574"></a><tt class="py-lineno">574</tt>  <tt class="py-line">        <tt class="py-name">logs</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L575"></a><tt class="py-lineno">575</tt>  <tt class="py-line">        <tt class="py-name">at</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L576"></a><tt class="py-lineno">576</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-name">at</tt> <tt class="py-op">!=</tt> <tt class="py-number">0xFF</tt><tt class="py-op">:</tt> </tt>
<a name="L577"></a><tt class="py-lineno">577</tt>  <tt class="py-line">            <tt class="py-name">at</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-237" class="py-name"><a title="openttd.savegame.CDataPacket.read_byte" class="py-name" href="#" onclick="return doclink('link-237', 'read_byte', 'link-56');">read_byte</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L578"></a><tt class="py-lineno">578</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">at</tt> <tt class="py-op">==</tt> <tt class="py-number">0xFF</tt><tt class="py-op">:</tt> </tt>
<a name="L579"></a><tt class="py-lineno">579</tt>  <tt class="py-line">                <tt class="py-keyword">break</tt> </tt>
<a name="L580"></a><tt class="py-lineno">580</tt>  <tt class="py-line">            <tt class="py-name">action</tt> <tt class="py-op">=</tt> <tt class="py-name">at</tt> </tt>
<a name="L581"></a><tt class="py-lineno">581</tt>  <tt class="py-line">            <tt class="py-name">tick</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-238" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint16" class="py-name" href="#" onclick="return doclink('link-238', 'read_uint16', 'link-143');">read_uint16</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L582"></a><tt class="py-lineno">582</tt>  <tt class="py-line">             </tt>
<a name="L583"></a><tt class="py-lineno">583</tt>  <tt class="py-line">            <tt class="py-name">ct</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
<a name="L584"></a><tt class="py-lineno">584</tt>  <tt class="py-line">            <tt class="py-keyword">while</tt> <tt class="py-name">ct</tt> <tt class="py-op">!=</tt> <tt class="py-number">0xFF</tt><tt class="py-op">:</tt> </tt>
<a name="L585"></a><tt class="py-lineno">585</tt>  <tt class="py-line">                <tt class="py-name">ct</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-239" class="py-name"><a title="openttd.savegame.CDataPacket.read_byte" class="py-name" href="#" onclick="return doclink('link-239', 'read_byte', 'link-56');">read_byte</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L586"></a><tt class="py-lineno">586</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">ct</tt> <tt class="py-op">==</tt> <tt class="py-number">0xFF</tt><tt class="py-op">:</tt> </tt>
<a name="L587"></a><tt class="py-lineno">587</tt>  <tt class="py-line">                    <tt class="py-keyword">break</tt> </tt>
<a name="L588"></a><tt class="py-lineno">588</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">ct</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> <tt class="py-comment"># mode</tt> </tt>
<a name="L589"></a><tt class="py-lineno">589</tt>  <tt class="py-line">                    <tt class="py-name">mode</tt>      <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-240" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint8" class="py-name" href="#" onclick="return doclink('link-240', 'read_uint8', 'link-194');">read_uint8</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L590"></a><tt class="py-lineno">590</tt>  <tt class="py-line">                    <tt class="py-name">landscape</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-241" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint8" class="py-name" href="#" onclick="return doclink('link-241', 'read_uint8', 'link-194');">read_uint8</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L591"></a><tt class="py-lineno">591</tt>  <tt class="py-line">                    <tt class="py-name">logs</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">tick</tt><tt class="py-op">,</tt> <tt class="py-name">ct</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-name">mode</tt><tt class="py-op">,</tt> <tt class="py-name">landscape</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L592"></a><tt class="py-lineno">592</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">ct</tt> <tt class="py-op">==</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt> <tt class="py-comment"># revision</tt> </tt>
<a name="L593"></a><tt class="py-lineno">593</tt>  <tt class="py-line">                    <tt class="py-name">str</tt>      <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-242" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-242', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'15s'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">replace</tt><tt class="py-op">(</tt><tt class="py-string">'\x00'</tt><tt class="py-op">,</tt> <tt class="py-string">""</tt><tt class="py-op">)</tt> </tt>
<a name="L594"></a><tt class="py-lineno">594</tt>  <tt class="py-line">                    <tt class="py-name">newgrf</tt>   <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-243" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint32" class="py-name" href="#" onclick="return doclink('link-243', 'read_uint32', 'link-78');">read_uint32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L595"></a><tt class="py-lineno">595</tt>  <tt class="py-line">                    <tt class="py-name">slver</tt>    <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-244" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint16" class="py-name" href="#" onclick="return doclink('link-244', 'read_uint16', 'link-143');">read_uint16</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L596"></a><tt class="py-lineno">596</tt>  <tt class="py-line">                    <tt class="py-name">modified</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-245" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint8" class="py-name" href="#" onclick="return doclink('link-245', 'read_uint8', 'link-194');">read_uint8</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L597"></a><tt class="py-lineno">597</tt>  <tt class="py-line">                    <tt class="py-name">logs</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">tick</tt><tt class="py-op">,</tt> <tt class="py-name">ct</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-name">str</tt><tt class="py-op">,</tt> <tt class="py-name">newgrf</tt><tt class="py-op">,</tt> <tt class="py-name">slver</tt><tt class="py-op">,</tt> <tt class="py-name">modified</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L598"></a><tt class="py-lineno">598</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">ct</tt> <tt class="py-op">==</tt> <tt class="py-number">2</tt><tt class="py-op">:</tt> <tt class="py-comment"># oldversion</tt> </tt>
<a name="L599"></a><tt class="py-lineno">599</tt>  <tt class="py-line">                    <tt id="link-246" class="py-name"><a title="ottd_client_event.IRCChat.type" class="py-name" href="#" onclick="return doclink('link-246', 'type', 'link-10');">type</a></tt>    <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-247" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint32" class="py-name" href="#" onclick="return doclink('link-247', 'read_uint32', 'link-78');">read_uint32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L600"></a><tt class="py-lineno">600</tt>  <tt class="py-line">                    <tt class="py-name">version</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-248" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint32" class="py-name" href="#" onclick="return doclink('link-248', 'read_uint32', 'link-78');">read_uint32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L601"></a><tt class="py-lineno">601</tt>  <tt class="py-line">                    <tt class="py-name">logs</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">tick</tt><tt class="py-op">,</tt> <tt class="py-name">ct</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt id="link-249" class="py-name"><a title="ottd_client_event.IRCChat.type" class="py-name" href="#" onclick="return doclink('link-249', 'type', 'link-10');">type</a></tt><tt class="py-op">,</tt> <tt class="py-name">version</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L602"></a><tt class="py-lineno">602</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">ct</tt> <tt class="py-op">==</tt> <tt class="py-number">3</tt><tt class="py-op">:</tt> <tt class="py-comment"># patch</tt> </tt>
<a name="L603"></a><tt class="py-lineno">603</tt>  <tt class="py-line">                    <tt id="link-250" class="py-name"><a title="sstruct.error.name" class="py-name" href="#" onclick="return doclink('link-250', 'name', 'link-123');">name</a></tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-251" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-251', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'128s'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">replace</tt><tt class="py-op">(</tt><tt class="py-string">'\x00'</tt><tt class="py-op">,</tt> <tt class="py-string">''</tt><tt class="py-op">)</tt> </tt>
<a name="L604"></a><tt class="py-lineno">604</tt>  <tt class="py-line">                    <tt class="py-name">oldval</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-252" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint32" class="py-name" href="#" onclick="return doclink('link-252', 'read_uint32', 'link-78');">read_uint32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L605"></a><tt class="py-lineno">605</tt>  <tt class="py-line">                    <tt class="py-name">newval</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-253" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint32" class="py-name" href="#" onclick="return doclink('link-253', 'read_uint32', 'link-78');">read_uint32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L606"></a><tt class="py-lineno">606</tt>  <tt class="py-line">                    <tt class="py-name">logs</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">tick</tt><tt class="py-op">,</tt> <tt class="py-name">ct</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt id="link-254" class="py-name"><a title="sstruct.error.name" class="py-name" href="#" onclick="return doclink('link-254', 'name', 'link-123');">name</a></tt><tt class="py-op">,</tt> <tt class="py-name">oldval</tt><tt class="py-op">,</tt> <tt class="py-name">newval</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L607"></a><tt class="py-lineno">607</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">ct</tt> <tt class="py-op">==</tt> <tt class="py-number">4</tt><tt class="py-op">:</tt> <tt class="py-comment"># add grf</tt> </tt>
<a name="L608"></a><tt class="py-lineno">608</tt>  <tt class="py-line">                    <tt class="py-name">id</tt>  <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-255" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-255', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'4s'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'hex'</tt><tt class="py-op">)</tt> </tt>
<a name="L609"></a><tt class="py-lineno">609</tt>  <tt class="py-line">                    <tt class="py-name">md5</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-256" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-256', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'16s'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'hex'</tt><tt class="py-op">)</tt> </tt>
<a name="L610"></a><tt class="py-lineno">610</tt>  <tt class="py-line">                    <tt class="py-name">logs</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">tick</tt><tt class="py-op">,</tt> <tt class="py-name">ct</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-name">id</tt><tt class="py-op">,</tt> <tt class="py-name">md5</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L611"></a><tt class="py-lineno">611</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">ct</tt> <tt class="py-op">==</tt> <tt class="py-number">5</tt><tt class="py-op">:</tt> <tt class="py-comment"># remove grf</tt> </tt>
<a name="L612"></a><tt class="py-lineno">612</tt>  <tt class="py-line">                    <tt class="py-name">id</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-257" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-257', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'4s'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'hex'</tt><tt class="py-op">)</tt> </tt>
<a name="L613"></a><tt class="py-lineno">613</tt>  <tt class="py-line">                    <tt class="py-name">logs</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">tick</tt><tt class="py-op">,</tt> <tt class="py-name">ct</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-name">id</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L614"></a><tt class="py-lineno">614</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">ct</tt> <tt class="py-op">==</tt> <tt class="py-number">6</tt><tt class="py-op">:</tt> <tt class="py-comment"># grfcompat</tt> </tt>
<a name="L615"></a><tt class="py-lineno">615</tt>  <tt class="py-line">                    <tt class="py-name">id</tt>  <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-258" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-258', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'4s'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'hex'</tt><tt class="py-op">)</tt> </tt>
<a name="L616"></a><tt class="py-lineno">616</tt>  <tt class="py-line">                    <tt class="py-name">md5</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-259" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-259', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'16s'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'hex'</tt><tt class="py-op">)</tt> </tt>
<a name="L617"></a><tt class="py-lineno">617</tt>  <tt class="py-line">                    <tt class="py-name">logs</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">tick</tt><tt class="py-op">,</tt> <tt class="py-name">ct</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-name">id</tt><tt class="py-op">,</tt> <tt class="py-name">md5</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L618"></a><tt class="py-lineno">618</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">ct</tt> <tt class="py-op">==</tt> <tt class="py-number">7</tt><tt class="py-op">:</tt> <tt class="py-comment"># param</tt> </tt>
<a name="L619"></a><tt class="py-lineno">619</tt>  <tt class="py-line">                    <tt class="py-name">id</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-260" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-260', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'4s'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'hex'</tt><tt class="py-op">)</tt> </tt>
<a name="L620"></a><tt class="py-lineno">620</tt>  <tt class="py-line">                    <tt class="py-name">logs</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">tick</tt><tt class="py-op">,</tt> <tt class="py-name">ct</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-name">id</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L621"></a><tt class="py-lineno">621</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">ct</tt> <tt class="py-op">==</tt> <tt class="py-number">8</tt><tt class="py-op">:</tt> <tt class="py-comment"># move</tt> </tt>
<a name="L622"></a><tt class="py-lineno">622</tt>  <tt class="py-line">                    <tt class="py-name">id</tt>     <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-261" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-261', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'4s'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'hex'</tt><tt class="py-op">)</tt> </tt>
<a name="L623"></a><tt class="py-lineno">623</tt>  <tt class="py-line">                    <tt id="link-262" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-262', 'offset', 'link-4');">offset</a></tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-263" class="py-name"><a title="openttd.savegame.CDataPacket.read_int32" class="py-name" href="#" onclick="return doclink('link-263', 'read_int32', 'link-192');">read_int32</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L624"></a><tt class="py-lineno">624</tt>  <tt class="py-line">                    <tt class="py-name">logs</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">tick</tt><tt class="py-op">,</tt> <tt class="py-name">ct</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-name">id</tt><tt class="py-op">,</tt> <tt id="link-264" class="py-name"><a title="openttd.client.DataPacket.offset
openttd.savegame.CDataPacket.offset" class="py-name" href="#" onclick="return doclink('link-264', 'offset', 'link-4');">offset</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L625"></a><tt class="py-lineno">625</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">ct</tt> <tt class="py-op">==</tt> <tt class="py-number">9</tt><tt class="py-op">:</tt> <tt class="py-comment"># bug</tt> </tt>
<a name="L626"></a><tt class="py-lineno">626</tt>  <tt class="py-line">                    <tt id="link-265" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-265', 'data', 'link-3');">data</a></tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-266" class="py-name" targets="Method openttd.savegame.CDataPacket.read_uint64()=openttd.savegame.CDataPacket-class.html#read_uint64"><a title="openttd.savegame.CDataPacket.read_uint64" class="py-name" href="#" onclick="return doclink('link-266', 'read_uint64', 'link-266');">read_uint64</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L627"></a><tt class="py-lineno">627</tt>  <tt class="py-line">                    <tt class="py-name">id</tt>   <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-267" class="py-name"><a title="openttd.savegame.CDataPacket.read_something" class="py-name" href="#" onclick="return doclink('link-267', 'read_something', 'link-39');">read_something</a></tt><tt class="py-op">(</tt><tt class="py-string">'4s'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'hex'</tt><tt class="py-op">)</tt> </tt>
<a name="L628"></a><tt class="py-lineno">628</tt>  <tt class="py-line">                    <tt class="py-name">bug</tt>  <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-268" class="py-name"><a title="openttd.savegame.CDataPacket.read_uint8" class="py-name" href="#" onclick="return doclink('link-268', 'read_uint8', 'link-194');">read_uint8</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L629"></a><tt class="py-lineno">629</tt>  <tt class="py-line">                    <tt class="py-name">logs</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">tick</tt><tt class="py-op">,</tt> <tt class="py-name">ct</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt id="link-269" class="py-name"><a title="openttd.client.DataPacket.data
openttd.savegame.CDataPacket.data" class="py-name" href="#" onclick="return doclink('link-269', 'data', 'link-3');">data</a></tt><tt class="py-op">,</tt> <tt class="py-name">id</tt><tt class="py-op">,</tt> <tt class="py-name">bug</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L630"></a><tt class="py-lineno">630</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gamelog</tt> <tt class="py-op">=</tt> <tt class="py-name">logs</tt> </tt>
</div><a name="OTTDSaveGameParser.readCHTS"></a><div id="OTTDSaveGameParser.readCHTS-def"><a name="L631"></a><tt class="py-lineno">631</tt> <a class="py-toggle" href="#" id="OTTDSaveGameParser.readCHTS-toggle" onclick="return toggle('OTTDSaveGameParser.readCHTS');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame.OTTDSaveGameParser-class.html#readCHTS">readCHTS</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">dp</tt><tt class="py-op">,</tt> <tt class="py-param">chunksize</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="OTTDSaveGameParser.readCHTS-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="OTTDSaveGameParser.readCHTS-expanded"><a name="L632"></a><tt class="py-lineno">632</tt>  <tt class="py-line">        <tt class="py-name">cheats</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L633"></a><tt class="py-lineno">633</tt>  <tt class="py-line">        <tt class="py-name">count</tt> <tt class="py-op">=</tt> <tt class="py-name">chunksize</tt> <tt class="py-op">/</tt> <tt class="py-number">2</tt> </tt>
<a name="L634"></a><tt class="py-lineno">634</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">i</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-name">count</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L635"></a><tt class="py-lineno">635</tt>  <tt class="py-line">            <tt class="py-name">been_used</tt> <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-270" class="py-name" targets="Method openttd.savegame.CDataPacket.read_bool()=openttd.savegame.CDataPacket-class.html#read_bool"><a title="openttd.savegame.CDataPacket.read_bool" class="py-name" href="#" onclick="return doclink('link-270', 'read_bool', 'link-270');">read_bool</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L636"></a><tt class="py-lineno">636</tt>  <tt class="py-line">            <tt class="py-name">value</tt>     <tt class="py-op">=</tt> <tt class="py-name">dp</tt><tt class="py-op">.</tt><tt id="link-271" class="py-name"><a title="openttd.savegame.CDataPacket.read_bool" class="py-name" href="#" onclick="return doclink('link-271', 'read_bool', 'link-270');">read_bool</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L637"></a><tt class="py-lineno">637</tt>  <tt class="py-line">            <tt class="py-name">cheats</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">been_used</tt><tt class="py-op">,</tt> <tt class="py-name">value</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L638"></a><tt class="py-lineno">638</tt>  <tt class="py-line">    <tt class="py-comment"># chunk handlers ///| -- end --</tt> </tt>
<a name="parseArgs"></a><div id="parseArgs-def"><a name="L639"></a><tt class="py-lineno">639</tt> <a class="py-toggle" href="#" id="parseArgs-toggle" onclick="return toggle('parseArgs');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame-module.html#parseArgs">parseArgs</a><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="parseArgs-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="parseArgs-expanded"><a name="L640"></a><tt class="py-lineno">640</tt>  <tt class="py-line">    <tt class="py-keyword">import</tt> <tt class="py-name">optparse</tt> </tt>
<a name="L641"></a><tt class="py-lineno">641</tt>  <tt class="py-line">    <tt class="py-comment"># parse the arguments</tt> </tt>
<a name="L642"></a><tt class="py-lineno">642</tt>  <tt class="py-line">    <tt class="py-name">usage</tt> <tt class="py-op">=</tt> <tt class="py-string">"usage: %prog [options]"</tt> </tt>
<a name="L643"></a><tt class="py-lineno">643</tt>  <tt class="py-line">    <tt class="py-name">description</tt> <tt class="py-op">=</tt> <tt class="py-string">"""This script will will parse an openttd savegame (http://www.openttd.org)</tt> </tt>
<a name="L644"></a><tt class="py-lineno">644</tt>  <tt class="py-line"><tt class="py-string">                    For more information, see the homepage: http://openttd-python.googlecode.com/."""</tt> </tt>
<a name="L645"></a><tt class="py-lineno">645</tt>  <tt class="py-line">    <tt class="py-name">argparser</tt> <tt class="py-op">=</tt> <tt class="py-name">optparse</tt><tt class="py-op">.</tt><tt class="py-name">OptionParser</tt><tt class="py-op">(</tt><tt class="py-name">usage</tt><tt class="py-op">=</tt><tt class="py-name">usage</tt><tt class="py-op">,</tt> <tt class="py-name">description</tt><tt class="py-op">=</tt><tt class="py-name">description</tt><tt class="py-op">)</tt> </tt>
<a name="L646"></a><tt class="py-lineno">646</tt>  <tt class="py-line">    <tt class="py-name">argparser</tt><tt class="py-op">.</tt><tt class="py-name">set_defaults</tt><tt class="py-op">(</tt><tt class="py-name">file</tt><tt class="py-op">=</tt><tt class="py-string">"network_tmp.sav"</tt><tt class="py-op">,</tt> <tt class="py-name">verbose</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-name">outformat</tt><tt class="py-op">=</tt><tt class="py-string">"uncompressed"</tt><tt class="py-op">,</tt> <tt class="py-name">readmaparray</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt> </tt>
<a name="L647"></a><tt class="py-lineno">647</tt>  <tt class="py-line">    <tt class="py-name">argparser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"-f"</tt><tt class="py-op">,</tt> <tt class="py-string">"--file"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"file"</tt><tt class="py-op">,</tt> <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"try to read from file FILE, if not given, default(network_tmp.sav) is used"</tt><tt class="py-op">,</tt> <tt id="link-272" class="py-name"><a title="ottd_client_event.IRCChat.type" class="py-name" href="#" onclick="return doclink('link-272', 'type', 'link-10');">type</a></tt><tt class="py-op">=</tt><tt class="py-string">"string"</tt><tt class="py-op">)</tt> </tt>
<a name="L648"></a><tt class="py-lineno">648</tt>  <tt class="py-line">    <tt class="py-name">argparser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"-v"</tt><tt class="py-op">,</tt> <tt class="py-string">"--verbose"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"verbose"</tt><tt class="py-op">,</tt> <tt class="py-name">action</tt><tt class="py-op">=</tt><tt class="py-string">"count"</tt><tt class="py-op">,</tt> <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"being verbose?"</tt><tt class="py-op">)</tt> </tt>
<a name="L649"></a><tt class="py-lineno">649</tt>  <tt class="py-line">    <tt class="py-name">argparser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"-d"</tt><tt class="py-op">,</tt> <tt class="py-string">"--recompress"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"recompress"</tt><tt class="py-op">,</tt> <tt class="py-name">metavar</tt><tt class="py-op">=</tt><tt class="py-string">"OUTFILE"</tt><tt class="py-op">,</tt> <tt id="link-273" class="py-name"><a title="ottd_client_event.IRCChat.type" class="py-name" href="#" onclick="return doclink('link-273', 'type', 'link-10');">type</a></tt><tt class="py-op">=</tt><tt class="py-string">"string"</tt><tt class="py-op">,</tt> <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"recompress and save to OUTFILE, will uncompress if outformat is not given"</tt><tt class="py-op">)</tt> </tt>
<a name="L650"></a><tt class="py-lineno">650</tt>  <tt class="py-line">    <tt class="py-name">argparser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"-o"</tt><tt class="py-op">,</tt> <tt class="py-string">"--outformat"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"outformat"</tt><tt class="py-op">,</tt> <tt id="link-274" class="py-name"><a title="ottd_client_event.IRCChat.type" class="py-name" href="#" onclick="return doclink('link-274', 'type', 'link-10');">type</a></tt><tt class="py-op">=</tt><tt class="py-string">"string"</tt><tt class="py-op">,</tt> <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"recompress using OUTFORMAT(LZO, ZLIB, uncompressed)"</tt><tt class="py-op">)</tt> </tt>
<a name="L651"></a><tt class="py-lineno">651</tt>  <tt class="py-line">    <tt class="py-name">argparser</tt><tt class="py-op">.</tt><tt class="py-name">add_option</tt><tt class="py-op">(</tt><tt class="py-string">"--skip-maparray"</tt><tt class="py-op">,</tt> <tt class="py-name">dest</tt><tt class="py-op">=</tt><tt class="py-string">"readmaparray"</tt><tt class="py-op">,</tt> <tt class="py-name">help</tt><tt class="py-op">=</tt><tt class="py-string">"do not read the map array"</tt><tt class="py-op">,</tt> <tt class="py-name">action</tt><tt class="py-op">=</tt><tt class="py-string">"store_false"</tt><tt class="py-op">)</tt> </tt>
<a name="L652"></a><tt class="py-lineno">652</tt>  <tt class="py-line">     </tt>
<a name="L653"></a><tt class="py-lineno">653</tt>  <tt class="py-line">    <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L654"></a><tt class="py-lineno">654</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-name">options</tt><tt class="py-op">,</tt> <tt class="py-name">args</tt><tt class="py-op">)</tt> <tt class="py-op">=</tt> <tt class="py-name">argparser</tt><tt class="py-op">.</tt><tt class="py-name">parse_args</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L655"></a><tt class="py-lineno">655</tt>  <tt class="py-line">    <tt class="py-keyword">except</tt> <tt class="py-name">optparse</tt><tt class="py-op">.</tt><tt class="py-name">OptionError</tt><tt class="py-op">,</tt> <tt class="py-name">err</tt><tt class="py-op">:</tt> </tt>
<a name="L656"></a><tt class="py-lineno">656</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt> <tt class="py-string">"Error while parsing arguments: "</tt><tt class="py-op">,</tt> <tt class="py-name">err</tt> </tt>
<a name="L657"></a><tt class="py-lineno">657</tt>  <tt class="py-line">        <tt class="py-name">argparser</tt><tt class="py-op">.</tt><tt class="py-name">print_help</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L658"></a><tt class="py-lineno">658</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> </tt>
<a name="L659"></a><tt class="py-lineno">659</tt>  <tt class="py-line">    <tt class="py-keyword">except</tt> <tt class="py-name">TypeError</tt><tt class="py-op">,</tt> <tt class="py-name">err</tt><tt class="py-op">:</tt> </tt>
<a name="L660"></a><tt class="py-lineno">660</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt> <tt class="py-string">"Error while parsing arguments: "</tt><tt class="py-op">,</tt> <tt class="py-name">err</tt> </tt>
<a name="L661"></a><tt class="py-lineno">661</tt>  <tt class="py-line">        <tt class="py-name">argparser</tt><tt class="py-op">.</tt><tt class="py-name">print_help</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L662"></a><tt class="py-lineno">662</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">hasattr</tt><tt class="py-op">(</tt><tt class="py-name">options</tt><tt class="py-op">,</tt> <tt class="py-string">"recompress"</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L663"></a><tt class="py-lineno">663</tt>  <tt class="py-line">        <tt class="py-name">recompress</tt> <tt class="py-op">=</tt> <tt class="py-name">options</tt><tt class="py-op">.</tt><tt class="py-name">recompress</tt> </tt>
<a name="L664"></a><tt class="py-lineno">664</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L665"></a><tt class="py-lineno">665</tt>  <tt class="py-line">        <tt class="py-name">recompress</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L666"></a><tt class="py-lineno">666</tt>  <tt class="py-line">     </tt>
<a name="L667"></a><tt class="py-lineno">667</tt>  <tt class="py-line">         </tt>
<a name="L668"></a><tt class="py-lineno">668</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">options</tt><tt class="py-op">.</tt><tt class="py-name">file</tt><tt class="py-op">,</tt> <tt class="py-name">options</tt><tt class="py-op">.</tt><tt class="py-name">verbose</tt><tt class="py-op">,</tt> <tt class="py-name">recompress</tt><tt class="py-op">,</tt> <tt class="py-name">options</tt><tt class="py-op">.</tt><tt class="py-name">outformat</tt><tt class="py-op">,</tt> <tt class="py-name">options</tt><tt class="py-op">.</tt><tt class="py-name">readmaparray</tt><tt class="py-op">)</tt> </tt>
</div><a name="L669"></a><tt class="py-lineno">669</tt>  <tt class="py-line"> </tt>
<a name="main"></a><div id="main-def"><a name="L670"></a><tt class="py-lineno">670</tt> <a class="py-toggle" href="#" id="main-toggle" onclick="return toggle('main');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="openttd.savegame-module.html#main">main</a><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="main-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="main-expanded"><a name="L671"></a><tt class="py-lineno">671</tt>  <tt class="py-line">    <tt class="py-name">file</tt><tt class="py-op">,</tt> <tt class="py-name">verbosity</tt><tt class="py-op">,</tt> <tt class="py-name">recompress</tt><tt class="py-op">,</tt> <tt class="py-name">outformat</tt><tt class="py-op">,</tt> <tt class="py-name">readmaparray</tt> <tt class="py-op">=</tt> <tt id="link-275" class="py-name" targets="Function openttd.savegame.parseArgs()=openttd.savegame-module.html#parseArgs"><a title="openttd.savegame.parseArgs" class="py-name" href="#" onclick="return doclink('link-275', 'parseArgs', 'link-275');">parseArgs</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L672"></a><tt class="py-lineno">672</tt>  <tt class="py-line">    <tt class="py-name">s</tt> <tt class="py-op">=</tt> <tt id="link-276" class="py-name" targets="Class openttd.savegame.OTTDSaveGameParser=openttd.savegame.OTTDSaveGameParser-class.html"><a title="openttd.savegame.OTTDSaveGameParser" class="py-name" href="#" onclick="return doclink('link-276', 'OTTDSaveGameParser', 'link-276');">OTTDSaveGameParser</a></tt><tt class="py-op">(</tt><tt class="py-name">file</tt><tt class="py-op">)</tt> </tt>
<a name="L673"></a><tt class="py-lineno">673</tt>  <tt class="py-line">    <tt class="py-name">s</tt><tt class="py-op">.</tt><tt class="py-name">verbosity</tt> <tt class="py-op">=</tt> <tt class="py-name">verbosity</tt> </tt>
<a name="L674"></a><tt class="py-lineno">674</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-string">"reading file \"%s\""</tt> <tt class="py-op">%</tt> <tt class="py-name">file</tt> </tt>
<a name="L675"></a><tt class="py-lineno">675</tt>  <tt class="py-line">    <tt class="py-name">s</tt><tt class="py-op">.</tt><tt id="link-277" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.readfile()=openttd.savegame.OTTDSaveGameParser-class.html#readfile"><a title="openttd.savegame.OTTDSaveGameParser.readfile" class="py-name" href="#" onclick="return doclink('link-277', 'readfile', 'link-277');">readfile</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L676"></a><tt class="py-lineno">676</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">verbosity</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> <tt class="py-keyword">print</tt> <tt class="py-name">s</tt><tt class="py-op">.</tt><tt class="py-name">rdp</tt><tt class="py-op">.</tt><tt id="link-278" class="py-name"><a title="openttd.client.DataPacket.size
openttd.savegame.CDataPacket.size" class="py-name" href="#" onclick="return doclink('link-278', 'size', 'link-2');">size</a></tt><tt class="py-op">,</tt> <tt class="py-string">"bytes long"</tt> </tt>
<a name="L677"></a><tt class="py-lineno">677</tt>  <tt class="py-line">    <tt class="py-name">s</tt><tt class="py-op">.</tt><tt id="link-279" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.readsaveheader()=openttd.savegame.OTTDSaveGameParser-class.html#readsaveheader"><a title="openttd.savegame.OTTDSaveGameParser.readsaveheader" class="py-name" href="#" onclick="return doclink('link-279', 'readsaveheader', 'link-279');">readsaveheader</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L678"></a><tt class="py-lineno">678</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-string">"savegame version %d.%d"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">s</tt><tt class="py-op">.</tt><tt class="py-name">saveload_version</tt><tt class="py-op">,</tt> <tt class="py-name">s</tt><tt class="py-op">.</tt><tt class="py-name">saveload_minor_version</tt><tt class="py-op">)</tt> </tt>
<a name="L679"></a><tt class="py-lineno">679</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-string">"compressed with"</tt><tt class="py-op">,</tt> <tt class="py-name">s</tt><tt class="py-op">.</tt><tt id="link-280" class="py-name"><a title="openttd.savegame.OTTDSaveGameParser.getSaveGameFormat" class="py-name" href="#" onclick="return doclink('link-280', 'getSaveGameFormat', 'link-102');">getSaveGameFormat</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
<a name="L680"></a><tt class="py-lineno">680</tt>  <tt class="py-line">    <tt class="py-name">s</tt><tt class="py-op">.</tt><tt id="link-281" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.uncompress()=openttd.savegame.OTTDSaveGameParser-class.html#uncompress"><a title="openttd.savegame.OTTDSaveGameParser.uncompress" class="py-name" href="#" onclick="return doclink('link-281', 'uncompress', 'link-281');">uncompress</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L681"></a><tt class="py-lineno">681</tt>  <tt class="py-line">    <tt class="py-name">chunkhandlers</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L682"></a><tt class="py-lineno">682</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">readmaparray</tt><tt class="py-op">:</tt> </tt>
<a name="L683"></a><tt class="py-lineno">683</tt>  <tt class="py-line">        <tt class="py-name">c</tt> <tt class="py-op">=</tt> <tt class="py-name">chunkhandlers</tt> </tt>
<a name="L684"></a><tt class="py-lineno">684</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'MAPT'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L685"></a><tt class="py-lineno">685</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'MAPO'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L686"></a><tt class="py-lineno">686</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'MAP2'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L687"></a><tt class="py-lineno">687</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'M3LO'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L688"></a><tt class="py-lineno">688</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'M3HI'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L689"></a><tt class="py-lineno">689</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'MAP5'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L690"></a><tt class="py-lineno">690</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'MAPE'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L691"></a><tt class="py-lineno">691</tt>  <tt class="py-line">        <tt class="py-name">c</tt><tt class="py-op">[</tt><tt class="py-string">'MAP7'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L692"></a><tt class="py-lineno">692</tt>  <tt class="py-line">    <tt class="py-name">s</tt><tt class="py-op">.</tt><tt id="link-282" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.loadChunks()=openttd.savegame.OTTDSaveGameParser-class.html#loadChunks"><a title="openttd.savegame.OTTDSaveGameParser.loadChunks" class="py-name" href="#" onclick="return doclink('link-282', 'loadChunks', 'link-282');">loadChunks</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L693"></a><tt class="py-lineno">693</tt>  <tt class="py-line">    <tt class="py-name">s</tt><tt class="py-op">.</tt><tt id="link-283" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.handleChunks()=openttd.savegame.OTTDSaveGameParser-class.html#handleChunks"><a title="openttd.savegame.OTTDSaveGameParser.handleChunks" class="py-name" href="#" onclick="return doclink('link-283', 'handleChunks', 'link-283');">handleChunks</a></tt><tt class="py-op">(</tt><tt class="py-name">chunkhandlers</tt><tt class="py-op">)</tt> </tt>
<a name="L694"></a><tt class="py-lineno">694</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-string">"map size: %(x)dx%(y)d"</tt> <tt class="py-op">%</tt> <tt class="py-name">s</tt><tt class="py-op">.</tt><tt class="py-name">mapsize</tt> </tt>
<a name="L695"></a><tt class="py-lineno">695</tt>  <tt class="py-line">     </tt>
<a name="L696"></a><tt class="py-lineno">696</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">recompress</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L697"></a><tt class="py-lineno">697</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt> <tt class="py-string">"recompressing file"</tt> </tt>
<a name="L698"></a><tt class="py-lineno">698</tt>  <tt class="py-line">        <tt class="py-name">format</tt> <tt class="py-op">=</tt> <tt class="py-name">s</tt><tt class="py-op">.</tt><tt id="link-284" class="py-name"><a title="openttd.savegame.OTTDSaveGameParser.getSaveGameFormat" class="py-name" href="#" onclick="return doclink('link-284', 'getSaveGameFormat', 'link-102');">getSaveGameFormat</a></tt><tt class="py-op">(</tt><tt class="py-name">outformat</tt><tt class="py-op">)</tt> </tt>
<a name="L699"></a><tt class="py-lineno">699</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">format</tt> <tt class="py-op">==</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">:</tt> </tt>
<a name="L700"></a><tt class="py-lineno">700</tt>  <tt class="py-line">            <tt class="py-keyword">print</tt> <tt class="py-string">"no such format"</tt> </tt>
<a name="L701"></a><tt class="py-lineno">701</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> </tt>
<a name="L702"></a><tt class="py-lineno">702</tt>  <tt class="py-line">        <tt class="py-name">s</tt><tt class="py-op">.</tt><tt id="link-285" class="py-name"><a title="openttd.savegame.OTTDSaveGameParser.compress
plugins.stats.MyHandler.compress
plugins.webserver.MyHandler.compress
webserver.MyHandler.compress" class="py-name" href="#" onclick="return doclink('link-285', 'compress', 'link-96');">compress</a></tt><tt class="py-op">(</tt><tt class="py-name">format</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> <tt class="py-comment"># yes, compress also uncompresses :-p</tt> </tt>
<a name="L703"></a><tt class="py-lineno">703</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt> <tt class="py-string">"writing save header"</tt> </tt>
<a name="L704"></a><tt class="py-lineno">704</tt>  <tt class="py-line">        <tt class="py-name">s</tt><tt class="py-op">.</tt><tt id="link-286" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.writesaveheader()=openttd.savegame.OTTDSaveGameParser-class.html#writesaveheader"><a title="openttd.savegame.OTTDSaveGameParser.writesaveheader" class="py-name" href="#" onclick="return doclink('link-286', 'writesaveheader', 'link-286');">writesaveheader</a></tt><tt class="py-op">(</tt><tt class="py-name">format</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-name">s</tt><tt class="py-op">.</tt><tt class="py-name">saveload_version</tt><tt class="py-op">,</tt> <tt class="py-name">s</tt><tt class="py-op">.</tt><tt class="py-name">saveload_minor_version</tt><tt class="py-op">)</tt> </tt>
<a name="L705"></a><tt class="py-lineno">705</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt> <tt class="py-string">"saving file"</tt> </tt>
<a name="L706"></a><tt class="py-lineno">706</tt>  <tt class="py-line">        <tt class="py-name">s</tt><tt class="py-op">.</tt><tt id="link-287" class="py-name" targets="Method openttd.savegame.OTTDSaveGameParser.writefile()=openttd.savegame.OTTDSaveGameParser-class.html#writefile"><a title="openttd.savegame.OTTDSaveGameParser.writefile" class="py-name" href="#" onclick="return doclink('link-287', 'writefile', 'link-287');">writefile</a></tt><tt class="py-op">(</tt><tt class="py-name">recompress</tt><tt class="py-op">)</tt> </tt>
</div><a name="L707"></a><tt class="py-lineno">707</tt>  <tt class="py-line"> </tt>
<a name="L708"></a><tt class="py-lineno">708</tt>  <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">__name__</tt> <tt class="py-op">==</tt> <tt class="py-string">'__main__'</tt><tt class="py-op">:</tt> </tt>
<a name="L709"></a><tt class="py-lineno">709</tt>  <tt class="py-line"><tt class="py-comment">#    import psyco</tt> </tt>
<a name="L710"></a><tt class="py-lineno">710</tt>  <tt class="py-line"><tt class="py-comment">#    psyco.full()</tt> </tt>
<a name="L711"></a><tt class="py-lineno">711</tt>  <tt class="py-line"><tt class="py-comment">#    print "using psyco..."</tt> </tt>
<a name="L712"></a><tt class="py-lineno">712</tt>  <tt class="py-line">    <tt id="link-288" class="py-name" targets="Function openttd.savegame.main()=openttd.savegame-module.html#main,Function plugins.main()=plugins-module.html#main"><a title="openttd.savegame.main
plugins.main" class="py-name" href="#" onclick="return doclink('link-288', 'main', 'link-288');">main</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L713"></a><tt class="py-lineno">713</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://openttd-python.googlecode.com">OpenTTD-Python</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Mon Oct 20 13:03:13 2008
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
